Hi, right now I'm lost a bit in the muddle of the various perl compilation flags and the sizes of some C datatypes. The task is simply to get the numerical maximum of a list of values. Could someone have a look at the following XSUB, especially at the #defines at the beginning? In particular, I am not sure about using long doubles when 64bit integers are in effect:
SV* max (...) PROTOTYPE: @ CODE: { #if defined USE_LONG_DOUBLE || defined USE_MORE_BITS || \ defined USE_LONG_LONG || defined USE_64_BIT_INT || \ defined USE_64_BIT_ALL # define MINDOUBLE LDBL_MIN register long double max; #else # define MINDOUBLE DBL_MIN register double max; #endif register int i; if (items == 1) { RETVAL = &PL_sv_undef; goto done; } if (SvOK(ST(0))) { RETVAL = ST(1); max = SvNV(ST(1)); } else { RETVAL = &PL_sv_undef; max = MINDOUBLE; } for (i = 2; i < items ; i++) { if (!SvOK(ST(i))) continue; if (SvNV(ST(i)) > max) { max = SvNV(ST(i)); RETVAL = ST(i); } } SvREFCNT_inc(RETVAL); done: ; } OUTPUT: RETVAL Cheers, Tassilo -- $_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({ pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#; $_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval