Fixed the RAN/DRAN intrinsic
This commit is contained in:
parent
9b1368ffe7
commit
f4f08e09aa
|
@ -79,7 +79,7 @@ intrinsicFunctions =
|
||||||
-- Elementary floating point functions
|
-- Elementary floating point functions
|
||||||
-- Appendix N of the occam 2 manual (and section J.4)
|
-- Appendix N of the occam 2 manual (and section J.4)
|
||||||
++ [(n, ts) | (n, (ts, _)) <- simpleFloatIntrinsics]
|
++ [(n, ts) | (n, (ts, _)) <- simpleFloatIntrinsics]
|
||||||
++ [("RAN", ([A.Real32, A.Int32], [(A.Int32, "N")]))]
|
++ concatMap doubleD [("RAN", ([A.Real32, A.Int32], [(A.Int32, "N")]))]
|
||||||
where
|
where
|
||||||
query n = (n, ([A.Bool], [(A.Real32, "X")]))
|
query n = (n, ([A.Bool], [(A.Real32, "X")]))
|
||||||
simple n = (n, ([A.Real32], [(A.Real32, "X")]))
|
simple n = (n, ([A.Real32], [(A.Real32, "X")]))
|
||||||
|
|
|
@ -190,3 +190,9 @@ static inline REAL ADD_PREFIX(SQRT) (REAL X, const char* pos) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline REAL ADD_PREFIX(RAN) (RINT, RINT*, const char*) occam_unused;
|
||||||
|
static inline REAL ADD_PREFIX(RAN) (RINT N, RINT* result1, const char* pos) {
|
||||||
|
int next = rand_r((unsigned*)&N);
|
||||||
|
*result1 = *(int*)&N;
|
||||||
|
return (REAL)next / (REAL)RAND_MAX;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user