@@ -272,13 +272,15 @@ trait PrimitiveOps extends Variables with OverloadHack {
272
272
def parseLong (s : Rep [String ])(implicit pos : SourceContext ) = obj_long_parse_long(s)
273
273
}
274
274
275
+ def infix_% (lhs : Rep [Long ], rhs : Rep [Long ])(implicit o : Overloaded2 , pos : SourceContext ) = long_mod(lhs, rhs)
275
276
def infix_& (lhs : Rep [Long ], rhs : Rep [Long ])(implicit o : Overloaded2 , pos : SourceContext ) = long_binaryand(lhs, rhs)
276
277
def infix_| (lhs : Rep [Long ], rhs : Rep [Long ])(implicit o : Overloaded2 , pos : SourceContext ) = long_binaryor(lhs, rhs)
277
278
def infix_<< (lhs : Rep [Long ], rhs : Rep [Int ])(implicit o : Overloaded2 , pos : SourceContext ) = long_shiftleft(lhs, rhs)
278
279
def infix_>>> (lhs : Rep [Long ], rhs : Rep [Int ])(implicit o : Overloaded2 , pos : SourceContext ) = long_shiftright_unsigned(lhs, rhs)
279
280
def infix_toInt (lhs : Rep [Long ])(implicit o : Overloaded2 , pos : SourceContext ) = long_toint(lhs)
280
281
281
282
def obj_long_parse_long (s : Rep [String ])(implicit pos : SourceContext ): Rep [Long ]
283
+ def long_mod (lhs : Rep [Long ], rhs : Rep [Long ])(implicit pos : SourceContext ): Rep [Long ]
282
284
def long_binaryand (lhs : Rep [Long ], rhs : Rep [Long ])(implicit pos : SourceContext ): Rep [Long ]
283
285
def long_binaryor (lhs : Rep [Long ], rhs : Rep [Long ])(implicit pos : SourceContext ): Rep [Long ]
284
286
def long_shiftleft (lhs : Rep [Long ], rhs : Rep [Int ])(implicit pos : SourceContext ): Rep [Long ]
@@ -410,13 +412,15 @@ trait PrimitiveOpsExp extends PrimitiveOps with EffectExp {
410
412
case class LongShiftLeft (lhs : Exp [Long ], rhs : Exp [Int ]) extends Def [Long ]
411
413
case class LongShiftRightUnsigned (lhs : Exp [Long ], rhs : Exp [Int ]) extends Def [Long ]
412
414
case class LongToInt (lhs : Exp [Long ]) extends Def [Int ]
415
+ case class LongMod (lhs : Exp [Long ], rhs : Exp [Long ]) extends Def [Long ]
413
416
414
417
def obj_long_parse_long (s : Exp [String ])(implicit pos : SourceContext ) = ObjLongParseLong (s)
415
418
def long_binaryor (lhs : Exp [Long ], rhs : Exp [Long ])(implicit pos : SourceContext ) = LongBinaryOr (lhs,rhs)
416
419
def long_binaryand (lhs : Exp [Long ], rhs : Exp [Long ])(implicit pos : SourceContext ) = LongBinaryAnd (lhs,rhs)
417
420
def long_shiftleft (lhs : Exp [Long ], rhs : Exp [Int ])(implicit pos : SourceContext ) = LongShiftLeft (lhs,rhs)
418
421
def long_shiftright_unsigned (lhs : Exp [Long ], rhs : Exp [Int ])(implicit pos : SourceContext ) = LongShiftRightUnsigned (lhs,rhs)
419
422
def long_toint (lhs : Exp [Long ])(implicit pos : SourceContext ) = LongToInt (lhs)
423
+ def long_mod (lhs : Exp [Long ], rhs : Exp [Long ])(implicit pos : SourceContext ) = LongMod (lhs, rhs)
420
424
421
425
override def mirror [A : Manifest ](e : Def [A ], f : Transformer )(implicit pos : SourceContext ): Exp [A ] = ({
422
426
implicit var a : Numeric [A ] = null // hack!! need to store it in Def instances??
@@ -461,6 +465,7 @@ trait PrimitiveOpsExp extends PrimitiveOps with EffectExp {
461
465
case IntShiftRightLogical (x,y) => int_rightshiftlogical(f(x),f(y))
462
466
case IntShiftRightArith (x,y) => int_rightshiftarith(f(x),f(y))
463
467
case ObjLongParseLong (x) => obj_long_parse_long(f(x))
468
+ case LongMod (x,y) => long_mod(f(x),f(y))
464
469
case LongShiftLeft (x,y) => long_shiftleft(f(x),f(y))
465
470
case LongBinaryOr (x,y) => long_binaryor(f(x),f(y))
466
471
case LongBinaryAnd (x,y) => long_binaryand(f(x),f(y))
@@ -505,6 +510,7 @@ trait PrimitiveOpsExp extends PrimitiveOps with EffectExp {
505
510
case Reflect (IntShiftLeft (x,y), u, es) => reflectMirrored(Reflect (IntShiftLeft (f(x),f(y)), mapOver(f,u), f(es)))(mtype(manifest[A ]), pos)
506
511
case Reflect (IntShiftRightLogical (x,y), u, es) => reflectMirrored(Reflect (IntShiftRightLogical (f(x),f(y)), mapOver(f,u), f(es)))(mtype(manifest[A ]), pos)
507
512
case Reflect (IntShiftRightArith (x,y), u, es) => reflectMirrored(Reflect (IntShiftRightArith (f(x),f(y)), mapOver(f,u), f(es)))(mtype(manifest[A ]), pos)
513
+ case Reflect (LongMod (x,y), u, es) => reflectMirrored(Reflect (LongMod (f(x),f(y)), mapOver(f,u), f(es)))(mtype(manifest[A ]), pos)
508
514
case Reflect (LongShiftLeft (x,y), u, es) => reflectMirrored(Reflect (LongShiftLeft (f(x),f(y)), mapOver(f,u), f(es)))(mtype(manifest[A ]), pos)
509
515
case Reflect (LongShiftRightUnsigned (x,y), u, es) => reflectMirrored(Reflect (LongShiftRightUnsigned (f(x),f(y)), mapOver(f,u), f(es)))(mtype(manifest[A ]), pos)
510
516
case Reflect (LongBinaryOr (x,y), u, es) => reflectMirrored(Reflect (LongBinaryOr (f(x),f(y)), mapOver(f,u), f(es)))(mtype(manifest[A ]), pos)
@@ -605,6 +611,7 @@ trait ScalaGenPrimitiveOps extends ScalaGenBase {
605
611
case IntToFloat (lhs) => emitValDef(sym, quote(lhs) + " .toFloat" )
606
612
case IntToDouble (lhs) => emitValDef(sym, quote(lhs) + " .toDouble" )
607
613
case ObjLongParseLong (s) => emitValDef(sym, " java.lang.Long.parseLong(" + quote(s) + " )" )
614
+ case LongMod (lhs,rhs) => emitValDef(sym, quote(lhs) + " % " + quote(rhs))
608
615
case LongBinaryOr (lhs,rhs) => emitValDef(sym, quote(lhs) + " | " + quote(rhs))
609
616
case LongBinaryAnd (lhs,rhs) => emitValDef(sym, quote(lhs) + " & " + quote(rhs))
610
617
case LongShiftLeft (lhs,rhs) => emitValDef(sym, quote(lhs) + " << " + quote(rhs))
@@ -659,6 +666,7 @@ trait CLikeGenPrimitiveOps extends CLikeGenBase {
659
666
case IntToFloat (lhs) => emitValDef(sym, " (float)" + quote(lhs))
660
667
case IntToDouble (lhs) => emitValDef(sym, " (double)" + quote(lhs))
661
668
case ObjLongParseLong (s) => emitValDef(sym, " strtod(" + quote(s) + " .c_str(),NULL)" )
669
+ case LongMod (lhs,rhs) => emitValDef(sym, quote(lhs) + " % " + quote(rhs))
662
670
case LongBinaryOr (lhs,rhs) => emitValDef(sym, quote(lhs) + " | " + quote(rhs))
663
671
case LongBinaryAnd (lhs,rhs) => emitValDef(sym, quote(lhs) + " & " + quote(rhs))
664
672
case LongShiftLeft (lhs,rhs) => emitValDef(sym, quote(lhs) + " << " + quote(rhs))
0 commit comments