forked from haskell/random
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request haskell#49 from idontgetoutmuch/improve-coverage
UniformRange for Float and Double
- Loading branch information
Showing
6 changed files
with
133 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* From: https://gitlab.haskell.org/ghc/ghc/-/blob/6d172e63f3dd3590b0a57371efb8f924f1fcdf05/libraries/base/cbits/CastFloatWord.cmm */ | ||
#include "Cmm.h" | ||
#include "MachDeps.h" | ||
|
||
#if WORD_SIZE_IN_BITS == 64 | ||
#define DOUBLE_SIZE_WDS 1 | ||
#else | ||
#define DOUBLE_SIZE_WDS 2 | ||
#endif | ||
|
||
#if SIZEOF_W == 4 | ||
#define TO_ZXW_(x) %zx32(x) | ||
#elif SIZEOF_W == 8 | ||
#define TO_ZXW_(x) %zx64(x) | ||
#endif | ||
|
||
stg_word64ToDoubleyg(I64 w) | ||
{ | ||
D_ d; | ||
P_ ptr; | ||
|
||
STK_CHK_GEN_N (DOUBLE_SIZE_WDS); | ||
|
||
reserve DOUBLE_SIZE_WDS = ptr { | ||
I64[ptr] = w; | ||
d = D_[ptr]; | ||
} | ||
|
||
return (d); | ||
} | ||
|
||
stg_word32ToFloatyg(W_ w) | ||
{ | ||
F_ f; | ||
P_ ptr; | ||
|
||
STK_CHK_GEN_N (1); | ||
|
||
reserve 1 = ptr { | ||
I32[ptr] = %lobits32(w); | ||
f = F_[ptr]; | ||
} | ||
|
||
return (f); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters