Changeset 53634f9 in mainline


Ignore:
Timestamp:
2009-01-31T13:24:32Z (16 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1e241723
Parents:
896ad9f
Message:

make RANDI a generic macro

Location:
kernel
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/src/boot/boot.S

    r896ad9f r53634f9  
    1 
     1#
    22# Copyright (c) 2005 Ondrej Palkovsky
    33# Copyright (c) 2006 Martin Decky
  • kernel/arch/ppc32/src/mm/tlb.c

    r896ad9f r53634f9  
    4141#include <print.h>
    4242#include <symtab.h>
     43#include <macros.h>
    4344
    4445
     
    130131
    131132
    132 /** Pseudorandom generator
    133  *
    134  * A pretty standard linear congruential pseudorandom
    135  * number generator (m = 2^32).
    136  *
    137  */
    138 #define RANDI(seed) \
    139         ({ \
    140                 (seed) = 1103515245 * (seed) + 12345; \
    141                 (seed); \
    142         })
    143 
    144 
    145133static void pht_insert(const uintptr_t vaddr, const pte_t *pte)
    146134{
  • kernel/generic/include/macros.h

    r896ad9f r53634f9  
    7777#define STRING_ARG(arg) #arg
    7878
     79/** Pseudorandom generator
     80 *
     81 * A pretty standard linear congruential pseudorandom
     82 * number generator (m = 2^32 or 2^64 depending on architecture).
     83 *
     84 */
     85#define RANDI(seed) \
     86        ({ \
     87                (seed) = 1103515245 * (seed) + 12345; \
     88                (seed); \
     89        })
     90
    7991#endif
    8092
  • kernel/test/synch/rwlock4.c

    r896ad9f r53634f9  
    6161        spinlock_lock(&rw_lock);       
    6262        rc = seed % max;
    63         seed = (((seed<<2) ^ (seed>>2)) * 487) + rc;
     63        seed = (((seed << 2) ^ (seed >> 2)) * 487) + rc;
    6464        spinlock_unlock(&rw_lock);
    6565        return rc;
  • kernel/test/synch/semaphore2.c

    r896ad9f r53634f9  
    5454        spinlock_lock(&sem_lock);       
    5555        rc = seed % max;
    56         seed = (((seed<<2) ^ (seed>>2)) * 487) + rc;
     56        seed = (((seed << 2) ^ (seed >> 2)) * 487) + rc;
    5757        spinlock_unlock(&sem_lock);
    5858        return rc;
Note: See TracChangeset for help on using the changeset viewer.