Hacker Newsnew | past | comments | ask | show | jobs | submit | RandomOnyx's commentslogin

Does rdrand32 and then taking the lowest 16 bits of its result yield any zeroes?

Basically I'm wondering if it's a bug in the version of the instruction that writes to a 16-bit reg, or a bug in the underlying RNG


Yes it does. rdrand32()%65535 was my first attempt, and generated zeroes at about the expected rate, that's why I initially erroneously thought my CPU did not have this problem.

You should be using &0xFFFF for masking. Your mod is off by 1 too.

You're right, the code was correct but my comment above is wrong.

How about* rdrand32()%65536? Taking the remainder by 65535 doesn't take the lowest 16 bits after all

*: missed a word the first time around


(in case it matters, I tried z80)

I see we have #include as usual, but how do I add files? Wasn't clear to me.

Also I would like to download the assembled & linked binary. That kind of usage may not be what you're going for, but then I can run it on an active device too, not just in the emulator.


The app was mostly made to run small snippets to teach assembly but I'm working on adding multiple source files right now and it's almost finished!

The long term goal was to also add "compile from C" which shows the C to assembly compilation, which can then be emulated line by line.

About the download of assembled binaries, on the roadmap there is upload and download of binaries so you can disassemble some binary, read the contents, compile programs and download them, the harder part is linking. All assemblers (except m68k) could in theory already export the binary, i just did not add the functionality yet.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: