I created a macro in MASM to ease direct access to the random array:
mov ebp, PRNG_CA_Pasqualoni_StateWidth / 4Here the random data is stored in EAX, and EBP indexes into the array. If using a register to index into the array seems like a bad idea then try to write a function with less overhead than load/storing a register. The intent is to churn through a massive number of random integers.
_0: PRNG_CA_Pasqualoni eax, ebp
; (do somthing with random data)
jXX _0 ; until exit condition reached
The features of MASM have been used to encapsulate the routine within an object module. Although the code is not lengthy it demonstrates coding techniques which make code reusable and easy to understand. The interface is described in a concise way within the include file - there is no need to look at the code to use the functions. Following the defined interface allows the code to operate in a transparent way. Within the assembly file all the nuances are explained making modification in the future less error prone. The file is small enough to fit on a couple screens of text and be quickly comprehended.
(Below is my MASM conversion.)
3 comments:
Hi bitRAKE
I saw you comment on the Steven Pinker, Robert Wright interview.
And I know you from your posts on Project Euler.
Small digital world.
Glad to see you have started a blog.
I will be sure to follow it!
My 1.6Ghz Dothan does 167 million random 32-bit numbers per second!
Post a Comment