]> pd.if.org Git - pdclib/blobdiff - functions/stdlib/strtoul.c
PDCLib includes with quotes, not <>.
[pdclib] / functions / stdlib / strtoul.c
index 568029756b69af9267be04b790ad5a086f0ba4bc..0bcb7dd2b608f621dd254cf926616918036720ee 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id$ */
-
 /* strtoul( const char *, char * *, int )
 
    This file is part of the Public Domain C Library (PDCLib).
@@ -27,7 +25,7 @@ unsigned long int strtoul( const char * s, char ** endptr, int base )
 #endif
 
 #ifdef TEST
-#include <_PDCLIB_test.h>
+#include "_PDCLIB_test.h"
 #include <errno.h>
 
 int main( void )
@@ -79,7 +77,8 @@ int main( void )
     /* for one-complement and signed magnitude just as well. Anyone having */
     /* a platform to test this on?                                         */
     errno = 0;
-#if ULONG_MAX == 0xffffffffL
+/* long -> 32 bit */
+#if ULONG_MAX >> 31 == 1
     /* testing "even" overflow, i.e. base is power of two */
     TESTCASE( strtoul( "4294967295", NULL, 0 ) == ULONG_MAX );
     TESTCASE( errno == 0 );
@@ -87,7 +86,8 @@ int main( void )
     TESTCASE( strtoul( "4294967296", NULL, 0 ) == ULONG_MAX );
     TESTCASE( errno == ERANGE );
     /* TODO: test "odd" overflow, i.e. base is not power of two */
-#elif ULONG_MAX == 0xffffffffffffffffL
+/* long -> 64 bit */
+#elif ULONG_MAX >> 63 == 1
     /* testing "even" overflow, i.e. base is power of two */
     TESTCASE( strtoul( "18446744073709551615", NULL, 0 ) == ULONG_MAX );
     TESTCASE( errno == 0 );