Correct support rshift for 64-bit numbers

This commit is contained in:
BorysLevytskyi
2023-05-08 16:49:53 +02:00
parent 86adc59c59
commit a12274940e
7 changed files with 122 additions and 58 deletions

View File

@@ -1,3 +1,4 @@
import calc from "../core/calc";
import { NumberType } from "../core/types";
import ScalarValue from "./ScalarValue";
@@ -20,7 +21,7 @@ function evalute(op1 : NumberType, operator: string, op2 : NumberType) : NumberT
switch(operator) {
case ">>": return (a >> b) as (NumberType);
case ">>>": return (a >>> b) as (NumberType);
case "<<": return (a << b) as (NumberType);
case "<<": return calc.rshift(a, b, calc.maxBitSize(a));
case "&": return (b & a) as (NumberType);
case "|": return (b | a) as (NumberType);
case "^": return (b ^ a) as (NumberType);

View File

@@ -13,7 +13,7 @@ interface ParserConfig {
}
export interface ParsedNumber {
value: number|bigint;
value: NumberType;
base: NumberBase;
input: string;
}