6767
6868#else // Linux, MacOS, etc.
6969
70- #if !defined( OLDGCC ) && !defined( M68K )
70+ #if !defined( OLDGCC ) && !defined( __mc68000__ )
7171 #include < termios.h>
7272 #endif
7373
74- #ifdef M68K
74+ #ifdef __mc68000__
7575extern " C" int nanosleep ( const struct timespec * duration, struct timespec * rem );
7676#endif
7777
@@ -87,7 +87,7 @@ extern "C" int nanosleep( const struct timespec * duration, struct timespec * re
8787
8888 inline void set_process_affinity ( uint64_t processAffinityMask )
8989 {
90- #if !defined(__APPLE__) && !defined( OLDGCC ) && !defined( M68K )
90+ #if !defined(__APPLE__) && !defined( OLDGCC ) && !defined( __mc68000__ )
9191 cpu_set_t mask;
9292 CPU_ZERO ( &mask );
9393
@@ -197,6 +197,10 @@ inline const char * target_platform()
197197 return " x86" ;
198198 #elif defined( __ARM_32BIT_STATE ) // ARM32 on Raspberry PI (and more)
199199 return " arm32" ;
200+ #elif defined( __mc68000__ )
201+ return " m68000" ;
202+ #elif defined( sparc )
203+ return " sparc" ;
200204 #else
201205 return " (other)" ;
202206 #endif
@@ -326,7 +330,7 @@ inline char printable( uint8_t x )
326330 return x;
327331} // printable
328332
329- #if ( ( defined( __clang__ ) || defined( __GNUC__ ) ) && !defined( OLDGCC ) && !defined( M68K ) )
333+ #if ( ( defined( __clang__ ) || defined( __GNUC__ ) ) && !defined( OLDGCC ) && !defined( __mc68000__ ) )
330334
331335 inline uint64_t flip_endian64 ( uint64_t x ) { return __builtin_bswap64 ( x ); }
332336 inline uint32_t flip_endian32 ( uint32_t x ) { return __builtin_bswap32 ( x ); }
@@ -358,3 +362,33 @@ inline char printable( uint8_t x )
358362
359363#endif
360364
365+ #ifdef sparc // If using buildroot and wide strings weren't included...
366+ inline size_t wcstombs ( char * dst, const wchar_t * src, size_t len ) // simplistic ascii-only version
367+ {
368+ if ( 0 == dst || 0 == src )
369+ return -1 ;
370+
371+ size_t i = 0 ;
372+ while ( ( i < ( len - 1 ) ) && src[i] )
373+ {
374+ dst[ i ] = (char ) src[ i ];
375+ i++;
376+ }
377+
378+ dst[ i ] = 0 ;
379+ return i;
380+ } // wcstombs
381+
382+ inline size_t wcslen (const wchar_t *str)
383+ {
384+ size_t len = 0 ;
385+ while ( *str )
386+ {
387+ len++;
388+ str++;
389+ }
390+ return len;
391+ } // wcslen
392+ #endif
393+
394+
0 commit comments