Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl-copy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Richard M Kreuter
cmucl-copy
Commits
d539b6a0
Commit
d539b6a0
authored
7 years ago
by
Raymond Toy
Browse files
Options
Downloads
Patches
Plain Diff
Define xoroshiro-next before xoroshiro-chunk.
parent
95a01145
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/code/rand-xoroshiro.lisp
+34
-26
34 additions, 26 deletions
src/code/rand-xoroshiro.lisp
with
34 additions
and
26 deletions
src/code/rand-xoroshiro.lisp
+
34
−
26
View file @
d539b6a0
...
@@ -120,32 +120,12 @@
...
@@ -120,32 +120,12 @@
;;;; Random entries:
;;;; Random entries:
;;; Size of the chunks returned by xoroshiro-chunk.
#+
x86
;;;
(
declaim
(
inline
xoroshiro-next
))
;;(defconstant random-chunk-length 32)
#+
x86
(
defun
xoroshiro-next
(
state
)
;;; xoroshiro-chunk -- Internal
(
declare
(
type
(
simple-array
double-float
(
2
))
state
))
;;;
(
vm::xoroshiro-next
state
))
;;; This function generaters a 32bit integer between 0 and #xffffffff
;;; inclusive.
;;;
(
declaim
(
inline
xoroshiro-chunk
))
(
defun
xoroshiro-chunk
(
rng-state
)
(
declare
(
type
xoro-random-state
rng-state
)
(
optimize
(
speed
3
)
(
safety
0
)))
(
let
((
cached
(
xoro-random-state-cached-p
rng-state
)))
(
cond
(
cached
(
setf
(
xoro-random-state-cached-p
rng-state
)
nil
)
(
xoro-random-state-rand
rng-state
))
(
t
(
let
((
s
(
xoro-random-state-state
rng-state
)))
(
declare
(
type
(
simple-array
double-float
(
2
))
s
))
(
multiple-value-bind
(
r1
r0
)
(
xoroshiro-next
s
)
(
setf
(
xoro-random-state-rand
rng-state
)
r0
)
(
setf
(
xoro-random-state-cached-p
rng-state
)
t
)
r1
))))))
#-
x86
#-
x86
(
defun
xoroshiro-next
(
state
)
(
defun
xoroshiro-next
(
state
)
...
@@ -225,6 +205,34 @@
...
@@ -225,6 +205,34 @@
(
rotl-36
s1-1
s1-0
)
(
rotl-36
s1-1
s1-0
)
(
setf
(
aref
state
0
)
(
make-double
s0-1
s0-0
)
(
setf
(
aref
state
0
)
(
make-double
s0-1
s0-0
)
(
aref
state
1
)
(
make-double
r1
r0
)))))))
(
aref
state
1
)
(
make-double
r1
r0
)))))))
;;; Size of the chunks returned by xoroshiro-chunk.
;;;
;;(defconstant random-chunk-length 32)
;;; xoroshiro-chunk -- Internal
;;;
;;; This function generaters a 32bit integer between 0 and #xffffffff
;;; inclusive.
;;;
(
declaim
(
inline
xoroshiro-chunk
))
(
defun
xoroshiro-chunk
(
rng-state
)
(
declare
(
type
xoro-random-state
rng-state
)
(
optimize
(
speed
3
)
(
safety
0
)))
(
let
((
cached
(
xoro-random-state-cached-p
rng-state
)))
(
cond
(
cached
(
setf
(
xoro-random-state-cached-p
rng-state
)
nil
)
(
xoro-random-state-rand
rng-state
))
(
t
(
let
((
s
(
xoro-random-state-state
rng-state
)))
(
declare
(
type
(
simple-array
double-float
(
2
))
s
))
(
multiple-value-bind
(
r1
r0
)
(
xoroshiro-next
s
)
(
setf
(
xoro-random-state-rand
rng-state
)
r0
)
(
setf
(
xoro-random-state-cached-p
rng-state
)
t
)
r1
))))))
;;; %RANDOM-SINGLE-FLOAT, %RANDOM-DOUBLE-FLOAT -- Interface
;;; %RANDOM-SINGLE-FLOAT, %RANDOM-DOUBLE-FLOAT -- Interface
;;;
;;;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment