The R Project SVN R

Rev

Rev 6203 | Rev 7002 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6203 Rev 6218
Line 511... Line 511...
511
/* i1 = i % n1; i2 = i % n2;
511
/* i1 = i % n1; i2 = i % n2;
512
 * this macro is quite a bit faster than having real modulo calls
512
 * this macro is quite a bit faster than having real modulo calls
513
 * in the loop (tested on Intel and Sparc)
513
 * in the loop (tested on Intel and Sparc)
514
 */
514
 */
515
#define mod_iterate(n1,n2,i1,i2) for (i=i1=i2=0; i<n; \
515
#define mod_iterate(n1,n2,i1,i2) for (i=i1=i2=0; i<n; \
-
 
516
	i1 = (++i1 == n1) ? 0 : i1,\
516
(++i1, (i1==n1)&&(i1=0), ++i2, (i2==n2)&&(i2=0), ++i))
517
	i2 = (++i2 == n2) ? 0 : i2,\
-
 
518
	++i)
517
 
519
 
518
static SEXP integer_binary(int code, SEXP s1, SEXP s2)
520
static SEXP integer_binary(int code, SEXP s1, SEXP s2)
519
{
521
{
520
    int i, i1, i2, n, n1, n2;
522
    int i, i1, i2, n, n1, n2;
521
    int x1, x2;
523
    int x1, x2;
Line 1108... Line 1110...
1108
    UNPROTECT(2);
1110
    UNPROTECT(2);
1109
    return a;
1111
    return a;
1110
}
1112
}
1111
 
1113
 
1112
#define mod_iterate3(n1,n2,n3,i1,i2,i3) for (i=i1=i2=i3=0; i<n; \
1114
#define mod_iterate3(n1,n2,n3,i1,i2,i3) for (i=i1=i2=i3=0; i<n; \
1113
	(++i1, (i1==n1)&&(i1=0),\
1115
	 i1 = (++i1==n1) ? 0 : i1,\
1114
	 ++i2, (i2==n2)&&(i2=0),\
1116
	 i2 = (++i2==n2) ? 0 : i2,\
1115
	 ++i3, (i3==n3)&&(i3=0), ++i))
1117
	 i3 = (++i3==n3) ? 0 : i3,\
-
 
1118
	 ++i)
1116
 
1119
 
1117
static SEXP math3(SEXP op, SEXP sa, SEXP sb, SEXP sc, double (*f)())
1120
static SEXP math3(SEXP op, SEXP sa, SEXP sb, SEXP sc, double (*f)())
1118
{
1121
{
1119
    SEXP sy;
1122
    SEXP sy;
1120
    int i, ia, ib, ic, n, na, nb, nc;
1123
    int i, ia, ib, ic, n, na, nb, nc;
Line 1266... Line 1269...
1266
    }
1269
    }
1267
    return op;			/* never used; to keep -Wall happy */
1270
    return op;			/* never used; to keep -Wall happy */
1268
} /* do_math3() */
1271
} /* do_math3() */
1269
 
1272
 
1270
#define mod_iterate4(n1,n2,n3,n4,i1,i2,i3,i4) for (i=i1=i2=i3=i4=0; i<n; \
1273
#define mod_iterate4(n1,n2,n3,n4,i1,i2,i3,i4) for (i=i1=i2=i3=i4=0; i<n; \
-
 
1274
	 i1 = (++i1==n1) ? 0 : i1,\
1271
(++i1, (i1==n1)&&(i1=0), ++i2, (i2==n2)&&(i2=0),\
1275
	 i2 = (++i2==n2) ? 0 : i2,\
-
 
1276
	 i3 = (++i3==n3) ? 0 : i3,\
1272
 ++i3, (i3==n3)&&(i3=0), ++i4, (i4==n4)&&(i4=0), ++i))
1277
	 i4 = (++i4==n4) ? 0 : i4,\
-
 
1278
	 ++i)
1273
 
1279
 
1274
static SEXP math4(SEXP op, SEXP sa, SEXP sb, SEXP sc, SEXP sd, double (*f)())
1280
static SEXP math4(SEXP op, SEXP sa, SEXP sb, SEXP sc, SEXP sd, double (*f)())
1275
{
1281
{
1276
    SEXP sy;
1282
    SEXP sy;
1277
    int i, ia, ib, ic, id, n, na, nb, nc, nd;
1283
    int i, ia, ib, ic, id, n, na, nb, nc, nd;