/*
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 * as tslib_1 from "tslib";
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
 */
var UltraCalcFunctionBitOperation = /** @class */ (function (_super) {
    tslib_1.__extends(UltraCalcFunctionBitOperation, _super);
    function UltraCalcFunctionBitOperation() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    UltraCalcFunctionBitOperation.prototype.evaluate = function (a, b) {
        var _this = this;
        return CalcFunctionUtilities.j(a, true, function (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)));
        });
    };
    UltraCalcFunctionBitOperation.prototype.get_minArgs = function () {
        return 2;
    };
    Object.defineProperty(UltraCalcFunctionBitOperation.prototype, "minArgs", {
        get: function () {
            return this.get_minArgs();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionBitOperation.prototype.get_maxArgs = function () {
        return 2;
    };
    Object.defineProperty(UltraCalcFunctionBitOperation.prototype, "maxArgs", {
        get: function () {
            return this.get_maxArgs();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionBitOperation._ak = function (a, b) {
        if (a < 0 || a % 1 != 0 || a >= 281474976710656) {
            return new ExcelCalcValue(new ExcelCalcErrorValue(4));
        }
        var c = truncate(Math.abs(b));
        if (c > 53) {
            return new ExcelCalcValue(new ExcelCalcErrorValue(4));
        }
        var d = truncate(a);
        if (b < 0) {
            d >>= c;
        }
        else {
            d <<= c;
        }
        return new ExcelCalcValue(d);
    };
    UltraCalcFunctionBitOperation.$t = markType(UltraCalcFunctionBitOperation, 'UltraCalcFunctionBitOperation', BuiltInFunctionBase.$);
    return UltraCalcFunctionBitOperation;
}(BuiltInFunctionBase));
export { UltraCalcFunctionBitOperation };
//# sourceMappingURL=UltraCalcFunctionBitOperation.js.map