Chameleon

Chameleon Svn Source Tree

Root/branches/meklort/i386/modules/klibc/jrand48.c

Source at commit 970 created 13 years 23 days ago.
By macman, ati.c, removed duplicate default "ATI Radeon HD 5400 Series", added Gigabyte "AMD Radeon HD 6850" OC device ID and added additional AMD 6000 cards with their default settings. Removed some blank lines.
1/*
2 * jrand48.c
3 */
4
5#include <stdlib.h>
6#include <stdint.h>
7
8long jrand48(unsigned short xsubi[3])
9{
10uint64_t x;
11
12/* The xsubi[] array is littleendian by spec */
13x = (uint64_t) (uint16_t) xsubi[0] +
14 ((uint64_t) (uint16_t) xsubi[1] << 16) +
15 ((uint64_t) (uint16_t) xsubi[2] << 32);
16
17x = (0x5deece66dULL * x) + 0xb;
18
19xsubi[0] = (unsigned short)(uint16_t) x;
20xsubi[1] = (unsigned short)(uint16_t) (x >> 16);
21xsubi[2] = (unsigned short)(uint16_t) (x >> 32);
22
23return (long)(int32_t) (x >> 16);
24}
25

Archive Download this file

Revision: 970