The R Project SVN R

Rev

Rev 87894 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 87894 Rev 88786
Line 228... Line 228...
228
    case NILSXP:
228
    case NILSXP:
229
	return TRUE;
229
	return TRUE;
230
    case LGLSXP:
230
    case LGLSXP:
231
	if (XLENGTH(x) != XLENGTH(y)) return FALSE;
231
	if (XLENGTH(x) != XLENGTH(y)) return FALSE;
232
	/* Use memcmp (which is ISO C90) to speed up the comparison */
232
	/* Use memcmp (which is ISO C90) to speed up the comparison */
233
	return memcmp((void *)LOGICAL(x), (void *)LOGICAL(y),
233
	return memcmp((const void *)LOGICAL_RO(x), (const void *)LOGICAL_RO(y),
234
		      xlength(x) * sizeof(int)) == 0 ? TRUE : FALSE;
234
		      xlength(x) * sizeof(int)) == 0 ? TRUE : FALSE;
235
    case INTSXP:
235
    case INTSXP:
236
	if (XLENGTH(x) != XLENGTH(y)) return FALSE;
236
	if (XLENGTH(x) != XLENGTH(y)) return FALSE;
237
	/* Use memcmp (which is ISO C90) to speed up the comparison */
237
	/* Use memcmp (which is ISO C90) to speed up the comparison */
238
	return memcmp((void *)INTEGER(x), (void *)INTEGER(y),
238
	return memcmp((const void *)INTEGER_RO(x), (const void *)INTEGER_RO(y),
239
		      xlength(x) * sizeof(int)) == 0 ? TRUE : FALSE;
239
		      xlength(x) * sizeof(int)) == 0 ? TRUE : FALSE;
240
    case REALSXP:
240
    case REALSXP:
241
    {
241
    {
242
	R_xlen_t n = XLENGTH(x);
242
	R_xlen_t n = XLENGTH(x);
243
	if(n != XLENGTH(y)) return FALSE;
243
	if(n != XLENGTH(y)) return FALSE;
244
	else {
244
	else {
245
	    double *xp = REAL(x), *yp = REAL(y);
245
	    const double *xp = REAL_RO(x), *yp = REAL_RO(y);
246
	    int ne_strict = NUM_EQ | (SINGLE_NA << 1);
246
	    int ne_strict = NUM_EQ | (SINGLE_NA << 1);
247
	    for(R_xlen_t i = 0; i < n; i++)
247
	    for(R_xlen_t i = 0; i < n; i++)
248
		if(neWithNaN(xp[i], yp[i], ne_strict)) return FALSE;
248
		if(neWithNaN(xp[i], yp[i], ne_strict)) return FALSE;
249
	}
249
	}
250
	return TRUE;
250
	return TRUE;
Line 252... Line 252...
252
    case CPLXSXP:
252
    case CPLXSXP:
253
    {
253
    {
254
	R_xlen_t n = XLENGTH(x);
254
	R_xlen_t n = XLENGTH(x);
255
	if(n != XLENGTH(y)) return FALSE;
255
	if(n != XLENGTH(y)) return FALSE;
256
	else {
256
	else {
257
	    Rcomplex *xp = COMPLEX(x), *yp = COMPLEX(y);
257
	    const Rcomplex *xp = COMPLEX_RO(x), *yp = COMPLEX_RO(y);
258
	    int ne_strict = NUM_EQ | (SINGLE_NA << 1);
258
	    int ne_strict = NUM_EQ | (SINGLE_NA << 1);
259
	    for(R_xlen_t i = 0; i < n; i++)
259
	    for(R_xlen_t i = 0; i < n; i++)
260
		if(neWithNaN(xp[i].r, yp[i].r, ne_strict) ||
260
		if(neWithNaN(xp[i].r, yp[i].r, ne_strict) ||
261
		   neWithNaN(xp[i].i, yp[i].i, ne_strict))
261
		   neWithNaN(xp[i].i, yp[i].i, ne_strict))
262
		    return FALSE;
262
		    return FALSE;
Line 343... Line 343...
343
	else
343
	else
344
	    return (EXTPTR_PTR(x) == EXTPTR_PTR(y) ? TRUE : FALSE);
344
	    return (EXTPTR_PTR(x) == EXTPTR_PTR(y) ? TRUE : FALSE);
345
    case RAWSXP:
345
    case RAWSXP:
346
	if (XLENGTH(x) != XLENGTH(y)) return FALSE;
346
	if (XLENGTH(x) != XLENGTH(y)) return FALSE;
347
	/* Use memcmp (which is ISO C90) to speed up the comparison */
347
	/* Use memcmp (which is ISO C90) to speed up the comparison */
348
	return memcmp((void *)RAW(x), (void *)RAW(y),
348
	return memcmp((const void *)RAW_RO(x), (const void *)RAW_RO(y),
349
		      XLENGTH(x) * sizeof(Rbyte)) == 0 ? TRUE : FALSE;
349
		      XLENGTH(x) * sizeof(Rbyte)) == 0 ? TRUE : FALSE;
350
    case PROMSXP:
350
    case PROMSXP:
351
    {
351
    {
352
	// args are evaluated -- but can be seen from DOTSXP dissection
352
	// args are evaluated -- but can be seen from DOTSXP dissection
353
	/* test for equality of the substituted expression -- or should
353
	/* test for equality of the substituted expression -- or should