예제 #1
0
파일: s_random.c 프로젝트: aharrison24/HAL
STATIC void * RNG_Lehmer_Init(Random * rnd)
{
    RNG_Lehmer_Data * r;
    UNREF(rnd);
    
    r = MEM_New(RNG_Lehmer_Data);
    if (r) {
        r->multiplier = __INT64_C(0x5DEECE66D);
        r->addend = __INT64_C(0xB);
        r->mask = (__INT64_C(1) << 48) - 1;
        r->seed = RANDOM_GenSeed();
    }
    return r;
}
예제 #2
0
TEST(easy_atomic, easy_bit)
{
    uint64_t                x = 0;
    int                     i;

    for(i = 0; i < 8; i++) easy_set_bit(i * 8, &x);

    EXPECT_EQ(x, __INT64_C(0x0101010101010101));

    for(i = 0; i < 8; i++) easy_set_bit(i * 8 + 7, &x);

    EXPECT_EQ(x, __INT64_C(0x8181818181818181));

    for(i = 0; i < 8; i++) easy_clear_bit(i * 8 + 7, &x);

    EXPECT_EQ(x, __INT64_C(0x0101010101010101));

    for(i = 0; i < 8; i++) easy_clear_bit(i * 8, &x);

    EXPECT_EQ(x, 0);
}
예제 #3
0
/******************************************************************************/
/* REXX Kernel                                                                */
/*                                                                            */
/* Utility class to manage the various sorts of numeric conversions required  */
/* by Rexx.  These conversions are all just static methods.                   */
/*                                                                            */
/******************************************************************************/

#include "RexxCore.h"
#include "Numerics.hpp"
#include "NumberStringClass.hpp"
#include "IntegerClass.hpp"
#include <limits.h>

#ifdef __REXX64__
const wholenumber_t Numerics::MAX_WHOLENUMBER = __INT64_C(999999999999999999);
const wholenumber_t Numerics::MIN_WHOLENUMBER = __INT64_C(-999999999999999999);
    // the digits setting used internally for function/method arguments to allow
    // for the full range
const size_t Numerics::ARGUMENT_DIGITS  = ((size_t)18);
// this is the digits setting for full size binary settings
const size_t Numerics::SIZE_DIGITS  = ((size_t)20);


/* Array for valid whole number at various digits settings */
/*  for value 1-18.                                         */
const wholenumber_t Numerics::validMaxWhole[] = {10,
                                           100,
                                           1000,
                                           10000,
                                           100000,