~mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
progs/perftest.c: Use from Glibc syscall numbers.
[catacomb]
/
rand
/
lcrand.c
diff --git
a/rand/lcrand.c
b/rand/lcrand.c
index
d8c4a37
..
f916c9c
100644
(file)
--- a/
rand/lcrand.c
+++ b/
rand/lcrand.c
@@
-33,6
+33,7
@@
#include <string.h>
#include <mLib/bits.h>
#include <string.h>
#include <mLib/bits.h>
+#include <mLib/macros.h>
#include <mLib/sub.h>
#include "grand.h"
#include <mLib/sub.h>
#include "grand.h"
@@
-106,15
+107,11
@@
uint32 lcrand(uint32 x)
/* --- Now reduce mod p --- *
*
/* --- Now reduce mod p --- *
*
- * I'm using shifts and adds to do the multiply step here. This needs to
- * be changed if @D@ ever becomes something other than 5.
+ * I'm using shifts and adds to do the multiply step here.
*/
*/
-#if D != 5
-# error "Change shift sequence!"
-#endif
-
{
{
+ STATIC_ASSERT(D == 5, "Shift sequence doesn't match prime");
uint32 q;
q = yy[1];
uint32 q;
q = yy[1];
@@
-244,7
+241,7
@@
static uint32 grange(grand *r, uint32 l)
static const grand_ops gops = {
"lcrand",
static const grand_ops gops = {
"lcrand",
-
LCRAND_P, 0
,
+
0, LCRAND_P
,
gmisc, gdestroy,
graw, gbyte, grand_defaultword, grange, grand_defaultfill
};
gmisc, gdestroy,
graw, gbyte, grand_defaultword, grange, grand_defaultfill
};