From fbbfbe897393c1898449bbedd9c11055b0926935 Mon Sep 17 00:00:00 2001 From: Chris Marshall Date: Tue, 22 Apr 2014 17:00:25 -0400 Subject: [PATCH] Switch double to PDL_Anyval where usage is generic This is for setting any type of PDL value. Original code assumed (double) worked for everything. Now we need to handle (64bit ints) as well. --- Basic/Core/Core.xs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Basic/Core/Core.xs b/Basic/Core/Core.xs index cdc1bf5ac..927615f8e 100644 --- a/Basic/Core/Core.xs +++ b/Basic/Core/Core.xs @@ -247,8 +247,8 @@ void propagate_badvalue( pdl *it ) { /* this is horrible - the routines from bad should perhaps be here instead ? */ -double pdl_get_badvalue( int datatype ) { - double retval; +PDL_Anyval pdl_get_badvalue( int datatype ) { + PDL_Anyval retval; switch ( datatype ) { #include "pdldataswitch.c" @@ -260,8 +260,8 @@ double pdl_get_badvalue( int datatype ) { } /* pdl_get_badvalue() */ -double pdl_get_pdl_badvalue( pdl *it ) { - double retval; +PDL_Anyval pdl_get_pdl_badvalue( pdl *it ) { + PDL_Anyval retval; int datatype; #if BADVAL_PER_PDL @@ -619,7 +619,7 @@ sclr_c(it) PDL_Indx nullp = 0; PDL_Indx dummyd = 1; PDL_Indx dummyi = 1; - double result; + PDL_Anyval result; CODE: /* get the first element of a piddle and return as * Perl double scalar (NV) @@ -645,7 +645,7 @@ at_c(x,position) PDL_Indx * pos; int npos; int ipos; - double result; + PDL_Anyval result; CODE: pdl_make_physvaffine( x ); @@ -681,7 +681,7 @@ at_bad_c(x,position) int npos; int ipos; int badflag; - double result; + PDL_Anyval result; CODE: pdl_make_physvaffine( x ); @@ -777,12 +777,12 @@ listref_c(x) #if BADVAL /* # note: - # the badvalue is stored in a double, but that's what pdl_at() + # the badvalue is stored in a PDL_Anyval, but that's what pdl_at() # returns */ SV *sv; - double pdl_val, pdl_badval; + PDL_Anyval pdl_val, pdl_badval; int badflag = (x->state & PDL_BADVAL) > 0; # if BADVAL_USENAN /* do we have to bother about NaN's? */ @@ -847,7 +847,7 @@ void set_c(x,position,value) pdl* x SV* position - double value + PDL_Anyval value PREINIT: PDL_Indx * pos; int npos;