Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganisation of the repo structure #4

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
96b1761
mv ocaml src
Kerl13 Apr 26, 2020
4aa7f55
Sm64 C reference implementation as an ocaml module
Kerl13 Apr 26, 2020
485e691
Test Sm64 against reference implementation
Kerl13 Apr 26, 2020
8f44bdd
xoshiro256++ ref implementation as an OCaml module
Kerl13 Apr 27, 2020
95401e2
Merge x256pp_c/* and stubs.c
Kerl13 Apr 27, 2020
430acce
Test X256pp.Int64 against reference implementation
Kerl13 Apr 27, 2020
e7697eb
Test X256pp.Int against reference implementation
Kerl13 Apr 27, 2020
e1d51d1
The c/ folder is obsolete
Kerl13 Apr 27, 2020
640b0a2
Remove obsolete tests
Kerl13 Apr 28, 2020
adc429d
Remove duplicate code
Kerl13 May 6, 2020
e29fb07
git mv * prng/
Kerl13 May 15, 2020
b256544
Remove CAMLprim everywhere
Kerl13 May 15, 2020
76a40dd
consistency: #define WHATEVER_H 1
Kerl13 May 15, 2020
050a066
mv some stuff WIP
Kerl13 May 15, 2020
0012f45
Hide x256pp_state (and fix a linker issue)
Kerl13 May 15, 2020
2add6b4
More consistent naming of tests
Kerl13 May 15, 2020
7bed7ad
mv dune-project back to the root of the repository
Kerl13 May 15, 2020
c452226
Internal testutils library
Kerl13 May 18, 2020
f3d83cf
Test: diff the output pure ocaml vs. pure C code
Kerl13 May 18, 2020
05999c0
Test all rngs against a C reference implementation
Kerl13 May 18, 2020
822a6e8
"True" reference implementations
Kerl13 May 18, 2020
ad76e7e
Remove old benchmark
Kerl13 May 18, 2020
f873f3e
Arg.align is nice!
Kerl13 May 18, 2020
0e6951b
Cleaner dune files
Kerl13 May 24, 2020
096214d
Remove some warnings
Kerl13 May 24, 2020
2e264aa
More C compiler warnings
Kerl13 May 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions c/.gitignore

This file was deleted.

15 changes: 0 additions & 15 deletions c/Makefile

This file was deleted.

24 changes: 0 additions & 24 deletions c/ocamlrandom.c

This file was deleted.

1 change: 0 additions & 1 deletion c/ocamlrandom.h

This file was deleted.

26 changes: 0 additions & 26 deletions c/splitmix64.c

This file was deleted.

3 changes: 0 additions & 3 deletions c/splitmix64.h

This file was deleted.

14 changes: 0 additions & 14 deletions c/testocamlrandom.c

This file was deleted.

16 changes: 0 additions & 16 deletions c/testsplitmix.c

This file was deleted.

15 changes: 0 additions & 15 deletions c/testxoshiro.c

This file was deleted.

50 changes: 0 additions & 50 deletions c/xoshiro256pp.c

This file was deleted.

17 changes: 0 additions & 17 deletions compare.sh

This file was deleted.

14 changes: 0 additions & 14 deletions ocaml/Makefile

This file was deleted.

3 changes: 0 additions & 3 deletions ocaml/splitmix/dune

This file was deleted.

13 changes: 0 additions & 13 deletions ocaml/tests/dune

This file was deleted.

10 changes: 0 additions & 10 deletions ocaml/tests/ocamlrandom.ml

This file was deleted.

13 changes: 0 additions & 13 deletions ocaml/tests/splitmix.ml

This file was deleted.

15 changes: 0 additions & 15 deletions ocaml/tests/xoshiro.ml

This file was deleted.

5 changes: 0 additions & 5 deletions ocaml/xoshiro/dune

This file was deleted.

55 changes: 0 additions & 55 deletions ocaml/xoshiro/x256pp_c/x256pp.c

This file was deleted.

12 changes: 0 additions & 12 deletions ocaml/xoshiro/x256pp_c/x256pp.h

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions prng/src/splitmix/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
(library
(name splitmix)
(foreign_archives splitmix)
(foreign_stubs (language c) (names stubs))
(libraries makeRandom)
(modules :standard \ Tests))

(foreign_library
(archive_name splitmix)
(language c)
(names reference))

(test
(name tests)
(modules Tests)
(libraries splitmix))
21 changes: 21 additions & 0 deletions prng/src/splitmix/reference.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Reference: http://prng.di.unimi.it/splitmix64.c

#include <stdint.h>

uint64_t sm64_next_stateless(uint64_t* s) {
uint64_t z = (*s += 0x9e3779b97f4a7c15);
z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9;
z = (z ^ (z >> 27)) * 0x94d049bb133111eb;
return z ^ (z >> 31);
}

static uint64_t state; /* The state can be seeded with any value. */

void sm64_seed(uint64_t seed) {
state = seed;
}
Kerl13 marked this conversation as resolved.
Show resolved Hide resolved

uint64_t sm64_next() {
return sm64_next_stateless(&state);
}

12 changes: 12 additions & 0 deletions prng/src/splitmix/reference.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef SPLITMIX64_H
#define SPLITMIX64_H
Kerl13 marked this conversation as resolved.
Show resolved Hide resolved

#include <stdint.h>

uint64_t sm64_next_stateless(uint64_t*);

void sm64_seed(uint64_t);
uint64_t sm64_next();

#endif

2 changes: 2 additions & 0 deletions prng/src/splitmix/reference.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
external seed: int64 -> unit = "caml_sm64_seed"
external next: unit -> int64 = "caml_sm64_next"
File renamed without changes.
Loading