import { BinaryDataType } from "../../../core/binary/type/BinaryDataType.js";
import { NumericType } from "../../../core/math/NumericType.js";

/**
 *
 * @param {BinaryDataType} dt
 * @returns {NumericType}
 */
export function numericTypeFromBinaryDataType(dt) {

    switch (dt) {
        case BinaryDataType.Uint8:
        case BinaryDataType.Uint16:
        case BinaryDataType.Uint32:
            return NumericType.Uint

        case BinaryDataType.Int8:
        case BinaryDataType.Int16:
        case BinaryDataType.Int32:
            return NumericType.Int;

        case BinaryDataType.Float16:
        case BinaryDataType.Float32:
        case BinaryDataType.Float64:
            return NumericType.Float;

        default:
            throw new Error(`Unsupported data type '${dt}'`);
    }

}