quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

quirks.h (488B)


      1 
      2 #include <stdlib.h>
      3 
      4 /* C++Builder defines a "random" macro */
      5 #undef random
      6 
      7 #ifdef __EMSCRIPTEN__
      8 # define strcmp(s1, s2) xstrcmp(s1, s2)
      9 
     10 static int
     11 strcmp(const char *s1, const char *s2)
     12 {
     13     while (*s1 == *s2++) {
     14         if (*s1++ == 0) {
     15             return 0;
     16         }
     17     }
     18     return *(unsigned char *) s1 - *(unsigned char *) --s2;
     19 }
     20 #endif
     21 
     22 #ifdef _WIN32
     23 static void
     24 srandom(unsigned seed)
     25 {
     26     srand(seed);
     27 }
     28 
     29 static long
     30 random(void)
     31 {
     32     return (long) rand();
     33 }
     34 #endif