@@ -131,7 +131,7 @@ SEXP dupVecIndex(SEXP x) {
131
131
const double * restrict px = REAL (x );
132
132
union uno tpv ;
133
133
for (int i = 0 ; i != n ; ++ i ) {
134
- tpv .d = px [i ]; // R_IsNA(px[i]) ? NA_REAL : (R_IsNaN(px[i]) ? R_NaN : px[i]);
134
+ tpv .d = px [i ] + 0.0 ; // R_IsNA(px[i]) ? NA_REAL : (R_IsNaN(px[i]) ? R_NaN : px[i]);
135
135
id = HASH (tpv .u [0 ] + tpv .u [1 ], K );
136
136
while (h [id ]) {
137
137
if (REQUAL (px [h [id ]- 1 ], px [i ])) {
@@ -157,9 +157,9 @@ SEXP dupVecIndex(SEXP x) {
157
157
} else if (C_IsNaN (tmp )) {
158
158
tmp .r = tmp .i = R_NaN ;
159
159
}
160
- tpv .d = tmp .r ;
160
+ tpv .d = tmp .r + 0.0 ;
161
161
u = tpv .u [0 ] ^ tpv .u [1 ];
162
- tpv .d = tmp .i ;
162
+ tpv .d = tmp .i + 0.0 ;
163
163
u ^= tpv .u [0 ] ^ tpv .u [1 ];
164
164
id = HASH (u , K );
165
165
while (h [id ]) {
@@ -295,7 +295,7 @@ SEXP dupVecIndexKeepNA(SEXP x) {
295
295
pans_i [i ] = NA_INTEGER ;
296
296
continue ;
297
297
}
298
- tpv .d = px [i ];
298
+ tpv .d = px [i ] + 0.0 ;
299
299
id = HASH (tpv .u [0 ] + tpv .u [1 ], K );
300
300
while (h [id ]) {
301
301
if (REQUAL (px [h [id ]- 1 ], px [i ])) {
@@ -320,9 +320,9 @@ SEXP dupVecIndexKeepNA(SEXP x) {
320
320
pans_i [i ] = NA_INTEGER ;
321
321
continue ;
322
322
}
323
- tpv .d = tmp .r ;
323
+ tpv .d = tmp .r + 0.0 ;
324
324
u = tpv .u [0 ] ^ tpv .u [1 ];
325
- tpv .d = tmp .i ;
325
+ tpv .d = tmp .i + 0.0 ;
326
326
u ^= tpv .u [0 ] ^ tpv .u [1 ];
327
327
id = HASH (u , K );
328
328
while (h [id ]) {
@@ -473,7 +473,7 @@ SEXP dupVecIndexTwoVectors(SEXP x, SEXP y) {
473
473
union uno tpx , tpy ;
474
474
// fill hash table with indices of 'table'
475
475
for (int i = 0 ; i != n ; ++ i ) {
476
- tpx .d = px [i ]; tpy .d = py [i ];
476
+ tpx .d = px [i ] + 0.0 ; tpy .d = py [i ] + 0.0 ;
477
477
id = HASH ((64988430769U * (tpx .u [0 ] + tpx .u [1 ])) + tpy .u [0 ] + tpy .u [1 ], K ); // Best combination it seems
478
478
while (h [id ]) {
479
479
hid = h [id ]- 1 ;
@@ -497,7 +497,7 @@ SEXP dupVecIndexTwoVectors(SEXP x, SEXP y) {
497
497
const double * restrict pr = REAL_RO (tx == REALSXP ? x : y );
498
498
union uno tpv ;
499
499
for (int i = 0 ; i != n ; ++ i ) {
500
- tpv .d = pr [i ];
500
+ tpv .d = pr [i ] + 0.0 ;
501
501
id = HASH ((64988430769U * pi [i ]) + tpv .u [0 ] + tpv .u [1 ], K ); // Best combination it seems
502
502
while (h [id ]) {
503
503
hid = h [id ]- 1 ;
@@ -517,7 +517,7 @@ SEXP dupVecIndexTwoVectors(SEXP x, SEXP y) {
517
517
const double * restrict pr = REAL_RO (tx == REALSXP ? x : y );
518
518
union uno tpv ;
519
519
for (int i = 0 ; i != n ; ++ i ) {
520
- tpv .d = pr [i ];
520
+ tpv .d = pr [i ] + 0.0 ;
521
521
id = HASH ((tpv .u [0 ] + tpv .u [1 ]) * ((uintptr_t )ps [i ] & 0xffffffff ), K ); // Best combination it seems
522
522
while (h [id ]) {
523
523
hid = h [id ]- 1 ;
@@ -655,7 +655,7 @@ int dupVecSecond(int *restrict pidx, int *restrict pans_i, SEXP x, const int n,
655
655
const unsigned int mult = (M - 1 ) / ng ; // -1 because C is zero indexed
656
656
union uno tpv ;
657
657
for (int i = 0 ; i != n ; ++ i ) {
658
- tpv .d = px [i ]; // R_IsNA(px[i]) ? NA_REAL : (R_IsNaN(px[i]) ? R_NaN :px[i]);
658
+ tpv .d = px [i ] + 0.0 ; // R_IsNA(px[i]) ? NA_REAL : (R_IsNaN(px[i]) ? R_NaN :px[i]);
659
659
id = (pidx [i ]* mult ) ^ HASH (tpv .u [0 ] + tpv .u [1 ], K ); // HASH((tpv.u[0] + tpv.u[1]) ^ pidx[i], K) + pidx[i]; // Note: This is much faster than just adding pidx[i] to the hash value...
660
660
while (h [id ]) { // Problem: This value might be seen before, but not in combination with that pidx value...
661
661
hid = h [id ]- 1 ; // The issue here is that REQUAL(px[hid], px[i]) could be true but pidx[hid] == pidx[i] fails, although the same combination of px and pidx could be seen earlier before...
@@ -683,9 +683,9 @@ int dupVecSecond(int *restrict pidx, int *restrict pans_i, SEXP x, const int n,
683
683
} else if (C_IsNaN (tmp )) {
684
684
tmp .r = tmp .i = R_NaN ;
685
685
}
686
- tpv .d = tmp .r ;
686
+ tpv .d = tmp .r + 0.0 ;
687
687
u = tpv .u [0 ] ^ tpv .u [1 ];
688
- tpv .d = tmp .i ;
688
+ tpv .d = tmp .i + 0.0 ;
689
689
u ^= tpv .u [0 ] ^ tpv .u [1 ];
690
690
id = (pidx [i ]* mult ) ^ HASH (u , K );
691
691
while (h [id ]) {
@@ -930,7 +930,7 @@ SEXP funiqueC(SEXP x) {
930
930
const double * restrict px = REAL (x );
931
931
union uno tpv ;
932
932
for (int i = 0 ; i != n ; ++ i ) {
933
- tpv .d = px [i ];
933
+ tpv .d = px [i ] + 0.0 ;
934
934
id = HASH (tpv .u [0 ] + tpv .u [1 ], K );
935
935
while (h [id ]) {
936
936
if (REQUAL (px [h [id ]- 1 ], px [i ])) goto rbl ;
@@ -961,9 +961,9 @@ SEXP funiqueC(SEXP x) {
961
961
} else if (C_IsNaN (tmp )) {
962
962
tmp .r = tmp .i = R_NaN ;
963
963
}
964
- tpv .d = tmp .r ;
964
+ tpv .d = tmp .r + 0.0 ;
965
965
u = tpv .u [0 ] ^ tpv .u [1 ];
966
- tpv .d = tmp .i ;
966
+ tpv .d = tmp .i + 0.0 ;
967
967
u ^= tpv .u [0 ] ^ tpv .u [1 ];
968
968
id = HASH (u , K );
969
969
while (h [id ]) {
0 commit comments