mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-23 11:00:31 +00:00
Improve documentation
The Cosmo API documentation page is pretty good now https://justine.lol/cosmopolitan/documentation.html
This commit is contained in:
parent
13437dd19b
commit
1bc3a25505
367 changed files with 2542 additions and 26178 deletions
|
@ -26,11 +26,11 @@
|
|||
hidden uint32_t g_rando32;
|
||||
|
||||
textstartup static void g_rando32_init() {
|
||||
register intptr_t *auxv asm("r15"); /* @see libc/crt/crt.S */
|
||||
asm volatile("" : "=r"(auxv));
|
||||
intptr_t *auxvp;
|
||||
if (!IsXnu() && !IsWindows()) {
|
||||
for (intptr_t *auxvp = auxv; auxvp[0]; auxvp += 2) {
|
||||
if (auxvp[0] == AT_RANDOM) {
|
||||
asm("mov\t%%r15,%0" : "=r"(auxvp)); /* libc/crt/crt.S */
|
||||
for (; *auxvp; auxvp += 2) {
|
||||
if (*auxvp == AT_RANDOM) {
|
||||
uint8_t(*sysrandseed)[16] = (uint8_t(*)[16])auxvp[1];
|
||||
if (sysrandseed) g_rando32 ^= read32le(&(*sysrandseed)[8]);
|
||||
return;
|
||||
|
|
|
@ -26,10 +26,10 @@
|
|||
hidden uint64_t g_rando64;
|
||||
|
||||
textstartup static void g_rando64_init() {
|
||||
register intptr_t *auxv asm("r15"); /* @see libc/crt/crt.S */
|
||||
asm volatile("" : "=r"(auxv));
|
||||
intptr_t *auxvp;
|
||||
if (!IsXnu() && !IsWindows()) {
|
||||
for (intptr_t *auxvp = auxv; auxvp[0]; auxvp += 2) {
|
||||
asm("mov\t%%r15,%0" : "=r"(auxvp)); /* libc/crt/crt.S */
|
||||
for (; auxvp[0]; auxvp += 2) {
|
||||
if (auxvp[0] == AT_RANDOM) {
|
||||
uint8_t(*sysrandseed)[16] = (uint8_t(*)[16])auxvp[1];
|
||||
if (sysrandseed) g_rando64 ^= read64le(&(*sysrandseed)[0]);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/safemacros.internal.h"
|
||||
#include "libc/bits/safemacros.h"
|
||||
#include "libc/calls/internal.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/rand/rand.h"
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include "libc/rand/rand.h"
|
||||
#include "libc/rand/xorshift.h"
|
||||
|
||||
hidden extern uint32_t g_rando32;
|
||||
|
||||
/**
|
||||
* This function is an independent 32-bit clone of rand64().
|
||||
*/
|
||||
|
@ -35,7 +37,6 @@ nodebuginfo uint32_t(rand32)(void) {
|
|||
} else {
|
||||
devrand(&res, sizeof(res));
|
||||
}
|
||||
extern uint32_t g_rando32 hidden;
|
||||
res ^= MarsagliaXorshift32(&g_rando32);
|
||||
}
|
||||
return res;
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include "libc/rand/rand.h"
|
||||
#include "libc/rand/xorshift.h"
|
||||
|
||||
hidden extern uint64_t g_rando64;
|
||||
|
||||
/**
|
||||
* Returns nondeterministic random number.
|
||||
*
|
||||
|
@ -42,7 +44,6 @@ nodebuginfo uint64_t(rand64)(void) {
|
|||
} else {
|
||||
devrand(&res, sizeof(res));
|
||||
}
|
||||
hidden extern uint64_t g_rando64;
|
||||
res ^= MarsagliaXorshift64(&g_rando64);
|
||||
}
|
||||
return res;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue