This repository has been archived by the owner on May 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
475 additions
and
112 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 |
---|---|---|
|
@@ -28,6 +28,7 @@ | |
] | ||
}, | ||
"dirs": [ | ||
"./src/prng", | ||
"./src/ctype", | ||
"./src/string" | ||
], | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package libc | ||
|
||
import unsafe "unsafe" | ||
|
||
func erand48(s *uint16) float64 { | ||
type _cgoa_19_drand48 struct { | ||
u uint64 | ||
} | ||
var x _cgoa_19_drand48 | ||
x.u = uint64(4607182418800017408) | __rand48_step(s, (*uint16)(unsafe.Pointer(uintptr(unsafe.Pointer((*uint16)(unsafe.Pointer(&__seed48))))+uintptr(int32(3))*2)))<<int32(4) | ||
return *(*float64)(unsafe.Pointer(&x)) - 1 | ||
} | ||
func drand48() float64 { | ||
return erand48((*uint16)(unsafe.Pointer(&__seed48))) | ||
} |
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,7 @@ | ||
package libc | ||
|
||
import unsafe "unsafe" | ||
|
||
func lcong48(p *uint16) { | ||
Memcpy(unsafe.Pointer((*uint16)(unsafe.Pointer(&__seed48))), unsafe.Pointer(p), 14) | ||
} |
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,10 @@ | ||
package libc | ||
|
||
import unsafe "unsafe" | ||
|
||
func nrand48(s *uint16) int64 { | ||
return int64(__rand48_step(s, (*uint16)(unsafe.Pointer(uintptr(unsafe.Pointer((*uint16)(unsafe.Pointer(&__seed48))))+uintptr(int32(3))*2))) >> int32(17)) | ||
} | ||
func lrand48() int64 { | ||
return nrand48((*uint16)(unsafe.Pointer(&__seed48))) | ||
} |
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,10 @@ | ||
package libc | ||
|
||
import unsafe "unsafe" | ||
|
||
func jrand48(s *uint16) int64 { | ||
return int64(int32(__rand48_step(s, (*uint16)(unsafe.Pointer(uintptr(unsafe.Pointer((*uint16)(unsafe.Pointer(&__seed48))))+uintptr(int32(3))*2))) >> int32(16))) | ||
} | ||
func mrand48() int64 { | ||
return jrand48((*uint16)(unsafe.Pointer(&__seed48))) | ||
} |
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,11 @@ | ||
package libc | ||
|
||
var seed_cgo18_rand uint64 | ||
|
||
func Srand(s uint32) { | ||
seed_cgo18_rand = uint64(s - uint32(1)) | ||
} | ||
func Rand() int32 { | ||
seed_cgo18_rand = uint64(6364136223846793005)*seed_cgo18_rand + uint64(1) | ||
return int32(seed_cgo18_rand >> int32(33)) | ||
} |
Oops, something went wrong.