/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { BuiltInFunctionBase } from "./BuiltInFunctionBase";
import { ExcelCalcValue } from "./ExcelCalcValue";
import { markType } from "igniteui-angular-core";
import { CalcFunctionUtilities } from "./CalcFunctionUtilities";
import { ExcelCalcErrorValue } from "./ExcelCalcErrorValue";
import { truncate } from "igniteui-angular-core";
/**
 * @hidden
 */
export let UltraCalcFunctionBitOperation = /*@__PURE__*/ (() => {
    class UltraCalcFunctionBitOperation extends BuiltInFunctionBase {
        evaluate(a, b) {
            return CalcFunctionUtilities.j(a, true, (c, d) => {
                if (c < 0 || d < 0 || c % 1 != 0 || d % 1 != 0 || c >= 281474976710656 || d >= 281474976710656) {
                    return new ExcelCalcValue(new ExcelCalcErrorValue(4));
                }
                return new ExcelCalcValue(this._am(truncate(c), truncate(d)));
            });
        }
        get_minArgs() {
            return 2;
        }
        get minArgs() {
            return this.get_minArgs();
        }
        get_maxArgs() {
            return 2;
        }
        get maxArgs() {
            return this.get_maxArgs();
        }
        static _ak(a, b) {
            if (a < 0 || a % 1 != 0 || a >= 281474976710656) {
                return new ExcelCalcValue(new ExcelCalcErrorValue(4));
            }
            let c = truncate(Math.abs(b));
            if (c > 53) {
                return new ExcelCalcValue(new ExcelCalcErrorValue(4));
            }
            let d = truncate(a);
            if (b < 0) {
                d >>= c;
            }
            else {
                d <<= c;
            }
            return new ExcelCalcValue(d);
        }
    }
    UltraCalcFunctionBitOperation.$t = markType(UltraCalcFunctionBitOperation, 'UltraCalcFunctionBitOperation', BuiltInFunctionBase.$);
    return UltraCalcFunctionBitOperation;
})();
