This commit is contained in:
Michal Moskal 2015-10-08 18:00:44 -07:00
Родитель 47977d5e3e
Коммит aa0b519378
2 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -1141,7 +1141,7 @@ module TDev.AST
if (astref && astref.isSynthetic)
astref = null
var inner:JsExpr = new JsInfix(args[0], specApply, args[1])
if (parName == "Number_" && Cloud.isRestricted() && astref && !astref.isShim) {
if (Cloud.isRestricted() && parName == "Number_" && astref && !astref.isShim) {
var over = Compiler.restrictedIntOps[propName]
if (over) inner = JsCall.direct("lib." + over, [args[0], args[1]])
}
@ -1172,6 +1172,8 @@ module TDev.AST
args.push(ctxArg);
if (astref && astref.compiledTypeArgs)
args.pushRange(astref.compiledTypeArgs)
if (Cloud.isRestricted() && parName == "Bits" && /^(or|and)_uint32$/.test(propName))
propName = propName.replace("uint32", "int32")
res = this.newTmpVarOrUnit(rk, "call", JsCall.mk(null, "lib." + parName + "." + propName, args));
} else {
var th = args.shift();

Просмотреть файл

@ -29,6 +29,12 @@ module TDev.RT {
//? Perform bitwise or (`|` in C)
export function or_uint32(x:number, y:number):number { return (x | y) >>> 0; }
//? Perform bitwise and (`&` in C) on signed integers
export function and_int32(x:number, y:number):number { return (x & y); }
//? Perform bitwise or (`|` in C) on signed integers
export function or_int32(x:number, y:number):number { return (x | y); }
//? Perform bitwise exclusive or (`^` in C)
export function xor_uint32(x:number, y:number):number { return (x ^ y) >>> 0; }