Changeset 1048 for libcaca/trunk/kernel/kernel.c
- Timestamp:
- Sep 17, 2006, 2:44:18 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/kernel/kernel.c
r944 r1048 30 30 #define LOWER(x) (IS_UPPER(x)?(x-('a'-'A')):x) 31 31 32 /* Our default seed for random number generator */ 33 static int seed = 0x68743284; 34 32 35 /* Our memory mapping */ 33 36 static uint32_t *freemem = (uint32_t*) 0x00200000; … … 95 98 } 96 99 100 int getpid(void) 101 { 102 return 0x1337; 103 } 104 105 void srand(unsigned int s) 106 { 107 seed = rand(); 108 } 109 110 int time(void *dummy) 111 { 112 return rand(); 113 } 114 97 115 int rand(void) 98 116 { 99 static int seed = 0x68743284;100 117 seed = (seed * 0x7f32ba17) ^ 0xf893a735; 101 118 return seed % RAND_MAX; … … 158 175 } 159 176 177 int memcmp(const char *s1, const char *s2, size_t n) 178 { 179 while(n) { 180 if(*s1 != *s2) return *s1-*s2; 181 *s1++; 182 *s2++; 183 n--; 184 } 185 return 0; 186 } 187 188 160 189 /* stdarg.h functions */ 161 190 int vsnprintf(char *str, size_t size, const char *format, va_list ap) … … 182 211 /* FIXME */ 183 212 return NULL; 213 } 214 215 size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) 216 { 217 return 0; 184 218 } 185 219 … … 299 333 } 300 334 335 336 /* XXX FIXME Converts only from little endian to big endian (x86) */ 337 unsigned int htonl(unsigned int hostlong) 338 { 339 return ((hostlong&0xFFFF0000)>>16)|((hostlong&0x0000FFFFFF)<<16); 340 } 341 342 /* XXX FIXME Converts only from little endian to big endian (x86) */ 343 unsigned short htons(unsigned short hostlong) 344 { 345 return ((hostlong&0xFF00)>>8)|((hostlong&0x00FF)<<8); 346 } 347 348 349 301 350 #endif /* __KERNEL__ */
Note: See TracChangeset
for help on using the changeset viewer.