Changeset bfc0f40 for src


Ignore:
Timestamp:
Oct 30, 2017, 6:18:06 PM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
9f865d1
Parents:
bd7f401
Message:

add more unsigned int rand48 routines

Location:
src/libcfa
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/stdlib

    rbd7f401 rbfc0f40  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Aug 23 20:29:47 2017
    13 // Update Count     : 224
     12// Last Modified On : Mon Oct 30 17:30:09 2017
     13// Update Count     : 242
    1414//
    1515
     
    2727// allocation, non-array types
    2828static inline forall( dtype T | sized(T) ) T * malloc( void ) {
    29         //printf( "X1\n" );
     29        // printf( "* malloc\n" );
    3030        return (T *)(void *)malloc( (size_t)sizeof(T) );        // C malloc
    3131} // malloc
     32
     33// static inline forall( dtype T | sized(T) ) T & malloc( void ) {
     34//      int & p = *(T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc
     35//      printf( "& malloc %p\n", &p );
     36//      return p;
     37// //   return (T &)*(T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc
     38// } // malloc
    3239
    3340extern "C" { void * calloc( size_t dim, size_t size ); } // default C routine
     
    208215void rand48seed( long int s );
    209216char rand48( void );
     217char rand48( char l, char u );
    210218int rand48( void );
    211219unsigned int rand48( void );
     220unsigned int rand48( unsigned int u );
     221unsigned int rand48( unsigned int l, unsigned int u );
    212222long int rand48( void );
    213223unsigned long int rand48( void );
     224unsigned long int rand48( unsigned long int u );
     225unsigned long int rand48( unsigned long int l, unsigned long int u );
    214226float rand48( void );
    215227double rand48( void );
  • src/libcfa/stdlib.c

    rbd7f401 rbfc0f40  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Aug 23 20:30:44 2017
    13 // Update Count     : 292
     12// Last Modified On : Mon Oct 30 17:53:04 2017
     13// Update Count     : 295
    1414//
    1515
     
    277277void rand48seed( long int s ) { srand48( s ); }
    278278char rand48( void ) { return mrand48(); }
     279char rand48( char l, char u ) { return lrand48() % (u - l) + l; }
    279280int rand48( void ) { return mrand48(); }
    280281unsigned int rand48( void ) { return lrand48(); }
     282unsigned int rand48( unsigned int u ) { return lrand48() % u; }
     283unsigned int rand48( unsigned int l, unsigned int u ) { return lrand48() % (u - l) + l; }
    281284long int rand48( void ) { return mrand48(); }
    282285unsigned long int rand48( void ) { return lrand48(); }
     286unsigned long int rand48( unsigned long int u ) { return lrand48() % u; }
     287unsigned long int rand48( unsigned long int l, unsigned long int u ) { return lrand48() % (u - l) + l; }
    283288float rand48( void ) { return (float)drand48(); }               // otherwise float uses lrand48
    284289double rand48( void ) { return drand48(); }
Note: See TracChangeset for help on using the changeset viewer.