# New Ticket Created by "Sisyphus" # Please include the string: [perl #129009] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=129009 > Hi, I'm assuming that UV_MAX (defined in perl.h) should be set to the maximum value that a UV can hold - ie to the value of ~0. However, on all "use 64bit int" builds that I've tested (from perl-5.12.0 to perl-5.25.3) I'm finding that UV_MAX is set to 4294967295, whereas the maximum value a UV can hold is 18446744073709551615. Here is the demo: ############################### C:\_32\>type try.pl use warnings; use strict; use Inline C => <<'EOC'; void foo() { #ifdef HAS_QUAD printf("has quad defined\n"); #endif #ifdef USE_64_BIT_INT printf("use 64bit int defined\n"); #endif #ifndef INT64_MAX printf("int64_max NOT defined\n"); #endif printf("%u %u %u %u\n", UV_MAX, QUADKIND, QUAD_IS_INT64_T, PERL_UQUAD_MAX); } EOC foo(); C:\_32>perl try.pl has quad defined use 64bit int defined int64_max NOT defined 4294967295 3 4 4294967295 C:\_32\>perl -le "print ~0;" 18446744073709551615 ############################### What is the best portable way to obtain the maximum UV value from within XS ? Here is the 'perl -V' output for the perl (5.25.3)that produced the above results: Summary of my perl5 (revision 5 version 25 subversion 3) configuration: Platform: osname=MSWin32 osvers=6.1 archname=MSWin32-x64-multi-thread uname='' config_args='undef' hint=recommended useposix=true d_sigaction=undef useithreads=define usemultiplicity=define use64bitint=define use64bitall=undef uselongdouble=undef usemymalloc=n bincompat5005=undef Compiler: cc='gcc' ccflags ' -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields' optimize='-s -O2' cppflags='-DWIN32' ccversion='' gccversion='5.3.0' gccosandvers='' intsize=4 longsize=4 ptrsize=8 doublesize=8 byteorder=12345678 doublekind=3 d_longlong=define longlongsize=8 d_longdbl=define longdblsize=16 longdblkind=3 ivtype='long long' ivsize=8 nvtype='double' nvsize=8 Off_t='long long' lseeksize=8 alignbytes=8 prototype=define Linker and Libraries: ld='g++' ldflags ='-s -L"c:\_64\blead-5.25.3\lib\CORE" -L"C:\_64\gcc-mingw-530\mingw64\lib"' libpth=C:\_64\gcc-mingw-530\mingw64\lib C:\_64\gcc-mingw-530\mingw64\x86_64-w64-mingw32\lib C:\_64\msys_530\1.0\local\lib C:\_64\gcc-mingw-530\mingw64\lib\gcc\x86_64-w64-mingw32\5.3.0 libs= -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 perllibs= -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 libc= so=dll useshrplib=true libperl=libperl525.a gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs dlext=dll d_dlsymun=undef ccdlflags=' ' cccdlflags=' ' lddlflags='-mdll -s -L"c:\_64\blead-5.25.3\lib\CORE" -L"C:\_64\gcc-mingw-530\mingw64\lib"' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES HAVE_INTERP_INTERN MULTIPLICITY PERLIO_LAYERS PERL_COPY_ON_WRITE PERL_DONT_CREATE_GVSV PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PERL_OP_PARENT PERL_PRESERVE_IVUV USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME USE_PERLIO USE_PERL_ATOF Built under MSWin32 Compiled at Jul 21 2016 11:10:53 @INC: C:/_64/blead-5.25.3/site/lib C:/_64/blead-5.25.3/lib .Thread Previous | Thread Next