HAIDOX
HAIDOX Help

Math Engine Reference: Configuration

개요

Immutable 계산 configuration layer와 deterministic resolver ABI다.

공개 API

Header 사용 시작

이 module의 public declaration을 사용하려면 installed SDK의 다음 header를 include한다.

#include <math_engine/math_engine_configuration.h>

Type과 callback

math_engine_configuration_source_t

Field별 resolver 우선순위다. 값이 클수록 우선한다.

typedef enum math_engine_configuration_source {
    /** Resolved field의 source가 없거나 유효하지 않음을 나타내는 sentinel이다. */
    MATH_ENGINE_CONFIGURATION_SOURCE_INVALID = 0,
    /** Linked build/runtime capability에서 선택한 최하위 우선순위 기본값이다. */
    MATH_ENGINE_CONFIGURATION_SOURCE_BUILD_CAPABILITY = 1,
    /** Product-default layer가 선택한 값이다. */
    MATH_ENGINE_CONFIGURATION_SOURCE_PRODUCT_DEFAULT = 2,
    /** Session-profile layer가 선택한 값이다. */
    MATH_ENGINE_CONFIGURATION_SOURCE_SESSION_PROFILE = 3,
    /** 현재 API call의 explicit layer가 선택한 최상위 우선순위 값이다. */
    MATH_ENGINE_CONFIGURATION_SOURCE_EXPLICIT_CALL = 4
} math_engine_configuration_source_t;
  • math_engine_configuration_source_t.MATH_ENGINE_CONFIGURATION_SOURCE_INVALID

    Resolved field의 source가 없거나 유효하지 않음을 나타내는 sentinel이다.

    /** Resolved field의 source가 없거나 유효하지 않음을 나타내는 sentinel이다. */
        MATH_ENGINE_CONFIGURATION_SOURCE_INVALID = 0,
    
  • math_engine_configuration_source_t.MATH_ENGINE_CONFIGURATION_SOURCE_BUILD_CAPABILITY

    Linked build/runtime capability에서 선택한 최하위 우선순위 기본값이다.

    /** Linked build/runtime capability에서 선택한 최하위 우선순위 기본값이다. */
        MATH_ENGINE_CONFIGURATION_SOURCE_BUILD_CAPABILITY = 1,
    
  • math_engine_configuration_source_t.MATH_ENGINE_CONFIGURATION_SOURCE_PRODUCT_DEFAULT

    Product-default layer가 선택한 값이다.

    /** Product-default layer가 선택한 값이다. */
        MATH_ENGINE_CONFIGURATION_SOURCE_PRODUCT_DEFAULT = 2,
    
  • math_engine_configuration_source_t.MATH_ENGINE_CONFIGURATION_SOURCE_SESSION_PROFILE

    Session-profile layer가 선택한 값이다.

    /** Session-profile layer가 선택한 값이다. */
        MATH_ENGINE_CONFIGURATION_SOURCE_SESSION_PROFILE = 3,
    
  • math_engine_configuration_source_t.MATH_ENGINE_CONFIGURATION_SOURCE_EXPLICIT_CALL

    현재 API call의 explicit layer가 선택한 최상위 우선순위 값이다.

    /** 현재 API call의 explicit layer가 선택한 최상위 우선순위 값이다. */
        MATH_ENGINE_CONFIGURATION_SOURCE_EXPLICIT_CALL = 4,
    

math_engine_configuration_layer_t

하나의 partial configuration layer다. present_fields 에 없는 field 값은 반드시 0이며 resolver가 읽지 않는다. Pointer와 process 전역 상태를 포함하지 않는다.

typedef struct math_engine_configuration_layer {
    /** Exact ABI byte size; 반드시 =sizeof(math_engine_configuration_layer_t)=이다. */
    uint32_t struct_size;
    /** =MATH_ENGINE_CONFIGURATION_LAYER_VERSION_1=인 ABI version이다. */
    uint32_t struct_version;
    /** =MATH_ENGINE_CONFIGURATION_FIELD_*= 조합이며 그 밖 bit는 reserved다. */
    uint64_t present_fields;
    /** Present일 때 =MATH_ENGINE_MODE_GAME_FAST..MATH_ENGINE_MODE_FULL=, 아니면 0이다. */
    uint32_t mode;
    /** Present일 때 유효한 =math_engine_scalar_backend_t= 값, 아니면 0이다. */
    uint32_t scalar_backend;
    /** Present일 때 deterministic 실행 요청 0 또는 1, 아니면 0이다. */
    uint32_t deterministic;
    /** Present일 때 capability 범위 안의 nonzero significand precision bit 수, 아니면 0이다. */
    uint32_t precision_bits;
    /** Version 1에서는 0이어야 하는 policy flag storage다. */
    uint32_t flags;
    /** Version 1에서는 0이어야 하는 alignment/future-use field다. */
    uint32_t reserved32;
    /** Version 1에서는 0이어야 하는 future-use field다. */
    uint64_t reserved64;
} math_engine_configuration_layer_t;
  • math_engine_configuration_layer_t.struct_size

    Exact ABI byte size; 반드시 sizeof(math_engine_configuration_layer_t) 이다.

    /** Exact ABI byte size; 반드시 =sizeof(math_engine_configuration_layer_t)=이다. */
        uint32_t struct_size;
    
  • math_engine_configuration_layer_t.struct_version

    MATH_ENGINE_CONFIGURATION_LAYER_VERSION_1 인 ABI version이다.

    /** =MATH_ENGINE_CONFIGURATION_LAYER_VERSION_1=인 ABI version이다. */
        uint32_t struct_version;
    
  • math_engine_configuration_layer_t.present_fields

    MATH_ENGINE_CONFIGURATION_FIELD_* 조합이며 그 밖 bit는 reserved다.

    /** =MATH_ENGINE_CONFIGURATION_FIELD_*= 조합이며 그 밖 bit는 reserved다. */
        uint64_t present_fields;
    
  • math_engine_configuration_layer_t.mode

    Present일 때 MATH_ENGINE_MODE_GAME_FAST..MATH_ENGINE_MODE_FULL, 아니면 0이다.

    /** Present일 때 =MATH_ENGINE_MODE_GAME_FAST..MATH_ENGINE_MODE_FULL=, 아니면 0이다. */
        uint32_t mode;
    
  • math_engine_configuration_layer_t.scalar_backend

    Present일 때 유효한 math_engine_scalar_backend_t 값, 아니면 0이다.

    /** Present일 때 유효한 =math_engine_scalar_backend_t= 값, 아니면 0이다. */
        uint32_t scalar_backend;
    
  • math_engine_configuration_layer_t.deterministic

    Present일 때 deterministic 실행 요청 0 또는 1, 아니면 0이다.

    /** Present일 때 deterministic 실행 요청 0 또는 1, 아니면 0이다. */
        uint32_t deterministic;
    
  • math_engine_configuration_layer_t.precision_bits

    Present일 때 capability 범위 안의 nonzero significand precision bit 수, 아니면 0이다.

    /** Present일 때 capability 범위 안의 nonzero significand precision bit 수, 아니면 0이다. */
        uint32_t precision_bits;
    
  • math_engine_configuration_layer_t.flags

    Version 1에서는 0이어야 하는 policy flag storage다.

    /** Version 1에서는 0이어야 하는 policy flag storage다. */
        uint32_t flags;
    
  • math_engine_configuration_layer_t.reserved32

    Version 1에서는 0이어야 하는 alignment/future-use field다.

    /** Version 1에서는 0이어야 하는 alignment/future-use field다. */
        uint32_t reserved32;
    
  • math_engine_configuration_layer_t.reserved64

    Version 1에서는 0이어야 하는 future-use field다.

    /** Version 1에서는 0이어야 하는 future-use field다. */
        uint64_t reserved64;
    

math_engine_resolved_configuration_t

Resolver가 성공 시 한 번에 commit하는 immutable value다. Fingerprint는 pointer, padding과 host endian을 제외하고 canonical field sequence를 FNV-1a64로 계산한다.

typedef struct math_engine_resolved_configuration {
    /** Exact ABI byte size인 =sizeof(math_engine_resolved_configuration_t)=이다. */
    uint32_t struct_size;
    /** =MATH_ENGINE_RESOLVED_CONFIGURATION_VERSION_1=인 ABI version이다. */
    uint32_t struct_version;
    /** 최종 선택된 =math_engine_mode_t= 값이다. */
    uint32_t mode;
    /** 최종 선택된 =math_engine_scalar_backend_t= 값이다. */
    uint32_t scalar_backend;
    /** 최종 deterministic 실행 policy이며 값 범위는 0 또는 1이다. */
    uint32_t deterministic;
    /** 선택 backend의 nonzero significand precision. 단위는 bit다. */
    uint32_t precision_bits;
    /** =mode=를 제공한 =math_engine_configuration_source_t= 값이다. */
    uint32_t mode_source;
    /** =scalar_backend=를 제공한 =math_engine_configuration_source_t= 값이다. */
    uint32_t scalar_backend_source;
    /** =deterministic=을 제공한 =math_engine_configuration_source_t= 값이다. */
    uint32_t deterministic_source;
    /** =precision_bits=를 제공한 =math_engine_configuration_source_t= 값이다. */
    uint32_t precision_source;
    /** Resolve 시 검증한 capability descriptor의 capability bitset snapshot이다. */
    uint64_t capability_bits;
    /** Resolve 시 검증한 capability descriptor의 canonical fingerprint다. */
    uint64_t capability_fingerprint;
    /** 이 구조체의 canonical value/source/capability field sequence fingerprint다. */
    uint64_t resolved_fingerprint;
    /** =resolved_fingerprint=에 사용한 algorithm ID이며 version 1 FNV-1a64다. */
    uint32_t fingerprint_algorithm;
    /** Version 1에서는 0이어야 하는 policy flag storage다. */
    uint32_t flags;
} math_engine_resolved_configuration_t;
  • math_engine_resolved_configuration_t.struct_size

    Exact ABI byte size인 sizeof(math_engine_resolved_configuration_t) 이다.

    /** Exact ABI byte size인 =sizeof(math_engine_resolved_configuration_t)=이다. */
        uint32_t struct_size;
    
  • math_engine_resolved_configuration_t.struct_version

    MATH_ENGINE_RESOLVED_CONFIGURATION_VERSION_1 인 ABI version이다.

    /** =MATH_ENGINE_RESOLVED_CONFIGURATION_VERSION_1=인 ABI version이다. */
        uint32_t struct_version;
    
  • math_engine_resolved_configuration_t.mode

    최종 선택된 math_engine_mode_t 값이다.

    /** 최종 선택된 =math_engine_mode_t= 값이다. */
        uint32_t mode;
    
  • math_engine_resolved_configuration_t.scalar_backend

    최종 선택된 math_engine_scalar_backend_t 값이다.

    /** 최종 선택된 =math_engine_scalar_backend_t= 값이다. */
        uint32_t scalar_backend;
    
  • math_engine_resolved_configuration_t.deterministic

    최종 deterministic 실행 policy이며 값 범위는 0 또는 1이다.

    /** 최종 deterministic 실행 policy이며 값 범위는 0 또는 1이다. */
        uint32_t deterministic;
    
  • math_engine_resolved_configuration_t.precision_bits

    선택 backend의 nonzero significand precision. 단위는 bit다.

    /** 선택 backend의 nonzero significand precision. 단위는 bit다. */
        uint32_t precision_bits;
    
  • math_engine_resolved_configuration_t.mode_source

    mode 를 제공한 math_engine_configuration_source_t 값이다.

    /** =mode=를 제공한 =math_engine_configuration_source_t= 값이다. */
        uint32_t mode_source;
    
  • math_engine_resolved_configuration_t.scalar_backend_source

    scalar_backend 를 제공한 math_engine_configuration_source_t 값이다.

    /** =scalar_backend=를 제공한 =math_engine_configuration_source_t= 값이다. */
        uint32_t scalar_backend_source;
    
  • math_engine_resolved_configuration_t.deterministic_source

    deterministic 을 제공한 math_engine_configuration_source_t 값이다.

    /** =deterministic=을 제공한 =math_engine_configuration_source_t= 값이다. */
        uint32_t deterministic_source;
    
  • math_engine_resolved_configuration_t.precision_source

    precision_bits 를 제공한 math_engine_configuration_source_t 값이다.

    /** =precision_bits=를 제공한 =math_engine_configuration_source_t= 값이다. */
        uint32_t precision_source;
    
  • math_engine_resolved_configuration_t.capability_bits

    Resolve 시 검증한 capability descriptor의 capability bitset snapshot이다.

    /** Resolve 시 검증한 capability descriptor의 capability bitset snapshot이다. */
        uint64_t capability_bits;
    
  • math_engine_resolved_configuration_t.capability_fingerprint

    Resolve 시 검증한 capability descriptor의 canonical fingerprint다.

    /** Resolve 시 검증한 capability descriptor의 canonical fingerprint다. */
        uint64_t capability_fingerprint;
    
  • math_engine_resolved_configuration_t.resolved_fingerprint

    이 구조체의 canonical value/source/capability field sequence fingerprint다.

    /** 이 구조체의 canonical value/source/capability field sequence fingerprint다. */
        uint64_t resolved_fingerprint;
    
  • math_engine_resolved_configuration_t.fingerprint_algorithm

    resolved_fingerprint 에 사용한 algorithm ID이며 version 1 FNV-1a64다.

    /** =resolved_fingerprint=에 사용한 algorithm ID이며 version 1 FNV-1a64다. */
        uint32_t fingerprint_algorithm;
    
  • math_engine_resolved_configuration_t.flags

    Version 1에서는 0이어야 하는 policy flag storage다.

    /** Version 1에서는 0이어야 하는 policy flag storage다. */
        uint32_t flags;
    

math_engine_binary_rounding_t

Binary floating operation의 directed rounding policy다.

typedef enum math_engine_binary_rounding {
    /** 유효한 directed-rounding policy가 없음을 나타내며 연산 입력으로 거부된다. */
    MATH_ENGINE_BINARY_ROUNDING_INVALID = 0,
    /** 가장 가까운 representable 값으로, 정확한 중간값은 짝수 significand로 반올림한다. */
    MATH_ENGINE_BINARY_ROUNDING_NEAREST_EVEN = 1,
    /** 정확한 값의 절댓값이 커지지 않도록 0 방향으로 반올림한다. */
    MATH_ENGINE_BINARY_ROUNDING_TOWARD_ZERO = 2,
    /** 정확한 값 이상인 가장 작은 representable 값, 즉 양의 infinity 방향으로 반올림한다. */
    MATH_ENGINE_BINARY_ROUNDING_UPWARD = 3,
    /** 정확한 값 이하인 가장 큰 representable 값, 즉 음의 infinity 방향으로 반올림한다. */
    MATH_ENGINE_BINARY_ROUNDING_DOWNWARD = 4
} math_engine_binary_rounding_t;
  • math_engine_binary_rounding_t.MATH_ENGINE_BINARY_ROUNDING_INVALID

    유효한 directed-rounding policy가 없음을 나타내며 연산 입력으로 거부된다.

    /** 유효한 directed-rounding policy가 없음을 나타내며 연산 입력으로 거부된다. */
        MATH_ENGINE_BINARY_ROUNDING_INVALID = 0,
    
  • math_engine_binary_rounding_t.MATH_ENGINE_BINARY_ROUNDING_NEAREST_EVEN

    가장 가까운 representable 값으로, 정확한 중간값은 짝수 significand로 반올림한다.

    /** 가장 가까운 representable 값으로, 정확한 중간값은 짝수 significand로 반올림한다. */
        MATH_ENGINE_BINARY_ROUNDING_NEAREST_EVEN = 1,
    
  • math_engine_binary_rounding_t.MATH_ENGINE_BINARY_ROUNDING_TOWARD_ZERO

    정확한 값의 절댓값이 커지지 않도록 0 방향으로 반올림한다.

    /** 정확한 값의 절댓값이 커지지 않도록 0 방향으로 반올림한다. */
        MATH_ENGINE_BINARY_ROUNDING_TOWARD_ZERO = 2,
    
  • math_engine_binary_rounding_t.MATH_ENGINE_BINARY_ROUNDING_UPWARD

    정확한 값 이상인 가장 작은 representable 값, 즉 양의 infinity 방향으로 반올림한다.

    /** 정확한 값 이상인 가장 작은 representable 값, 즉 양의 infinity 방향으로 반올림한다. */
        MATH_ENGINE_BINARY_ROUNDING_UPWARD = 3,
    
  • math_engine_binary_rounding_t.MATH_ENGINE_BINARY_ROUNDING_DOWNWARD

    정확한 값 이하인 가장 큰 representable 값, 즉 음의 infinity 방향으로 반올림한다.

    /** 정확한 값 이하인 가장 큰 representable 값, 즉 음의 infinity 방향으로 반올림한다. */
        MATH_ENGINE_BINARY_ROUNDING_DOWNWARD = 4,
    

math_engine_numeric_field_index_t

field_sources 배열의 stable index다.

typedef enum math_engine_numeric_field_index {
    /** =field_sources=에서 binary-rounding source를 찾는 index다. */
    MATH_ENGINE_NUMERIC_FIELD_INDEX_BINARY_ROUNDING = 0,
    /** =field_sources=에서 decimal-rounding source를 찾는 index다. */
    MATH_ENGINE_NUMERIC_FIELD_INDEX_DECIMAL_ROUNDING = 1,
    /** =field_sources=에서 length-tolerance source를 찾는 index다. */
    MATH_ENGINE_NUMERIC_FIELD_INDEX_LENGTH_TOLERANCE = 2,
    /** =field_sources=에서 time-tolerance source를 찾는 index다. */
    MATH_ENGINE_NUMERIC_FIELD_INDEX_TIME_TOLERANCE = 3,
    /** =field_sources=에서 angular-tolerance source를 찾는 index다. */
    MATH_ENGINE_NUMERIC_FIELD_INDEX_ANGULAR_TOLERANCE = 4,
    /** =field_sources=에서 residual-tolerance source를 찾는 index다. */
    MATH_ENGINE_NUMERIC_FIELD_INDEX_RESIDUAL_TOLERANCE = 5,
    /** =field_sources=에서 iteration-budget source를 찾는 index다. */
    MATH_ENGINE_NUMERIC_FIELD_INDEX_ITERATION_BUDGET = 6,
    /** =field_sources=에서 evaluation-budget source를 찾는 index다. */
    MATH_ENGINE_NUMERIC_FIELD_INDEX_EVALUATION_BUDGET = 7,
    /** =field_sources=에서 time-budget source를 찾는 index다. */
    MATH_ENGINE_NUMERIC_FIELD_INDEX_TIME_BUDGET_NS = 8,
    /** =field_sources=에서 memory-budget source를 찾는 index다. */
    MATH_ENGINE_NUMERIC_FIELD_INDEX_MEMORY_BUDGET_BYTES = 9,
    /** =field_sources=의 element 수이며 valid field index의 exclusive upper bound다. */
    MATH_ENGINE_NUMERIC_FIELD_INDEX_COUNT = 10
} math_engine_numeric_field_index_t;
  • math_engine_numeric_field_index_t.MATH_ENGINE_NUMERIC_FIELD_INDEX_BINARY_ROUNDING

    field_sources 에서 binary-rounding source를 찾는 index다.

    /** =field_sources=에서 binary-rounding source를 찾는 index다. */
        MATH_ENGINE_NUMERIC_FIELD_INDEX_BINARY_ROUNDING = 0,
    
  • math_engine_numeric_field_index_t.MATH_ENGINE_NUMERIC_FIELD_INDEX_DECIMAL_ROUNDING

    field_sources 에서 decimal-rounding source를 찾는 index다.

    /** =field_sources=에서 decimal-rounding source를 찾는 index다. */
        MATH_ENGINE_NUMERIC_FIELD_INDEX_DECIMAL_ROUNDING = 1,
    
  • math_engine_numeric_field_index_t.MATH_ENGINE_NUMERIC_FIELD_INDEX_LENGTH_TOLERANCE

    field_sources 에서 length-tolerance source를 찾는 index다.

    /** =field_sources=에서 length-tolerance source를 찾는 index다. */
        MATH_ENGINE_NUMERIC_FIELD_INDEX_LENGTH_TOLERANCE = 2,
    
  • math_engine_numeric_field_index_t.MATH_ENGINE_NUMERIC_FIELD_INDEX_TIME_TOLERANCE

    field_sources 에서 time-tolerance source를 찾는 index다.

    /** =field_sources=에서 time-tolerance source를 찾는 index다. */
        MATH_ENGINE_NUMERIC_FIELD_INDEX_TIME_TOLERANCE = 3,
    
  • math_engine_numeric_field_index_t.MATH_ENGINE_NUMERIC_FIELD_INDEX_ANGULAR_TOLERANCE

    field_sources 에서 angular-tolerance source를 찾는 index다.

    /** =field_sources=에서 angular-tolerance source를 찾는 index다. */
        MATH_ENGINE_NUMERIC_FIELD_INDEX_ANGULAR_TOLERANCE = 4,
    
  • math_engine_numeric_field_index_t.MATH_ENGINE_NUMERIC_FIELD_INDEX_RESIDUAL_TOLERANCE

    field_sources 에서 residual-tolerance source를 찾는 index다.

    /** =field_sources=에서 residual-tolerance source를 찾는 index다. */
        MATH_ENGINE_NUMERIC_FIELD_INDEX_RESIDUAL_TOLERANCE = 5,
    
  • math_engine_numeric_field_index_t.MATH_ENGINE_NUMERIC_FIELD_INDEX_ITERATION_BUDGET

    field_sources 에서 iteration-budget source를 찾는 index다.

    /** =field_sources=에서 iteration-budget source를 찾는 index다. */
        MATH_ENGINE_NUMERIC_FIELD_INDEX_ITERATION_BUDGET = 6,
    
  • math_engine_numeric_field_index_t.MATH_ENGINE_NUMERIC_FIELD_INDEX_EVALUATION_BUDGET

    field_sources 에서 evaluation-budget source를 찾는 index다.

    /** =field_sources=에서 evaluation-budget source를 찾는 index다. */
        MATH_ENGINE_NUMERIC_FIELD_INDEX_EVALUATION_BUDGET = 7,
    
  • math_engine_numeric_field_index_t.MATH_ENGINE_NUMERIC_FIELD_INDEX_TIME_BUDGET_NS

    field_sources 에서 time-budget source를 찾는 index다.

    /** =field_sources=에서 time-budget source를 찾는 index다. */
        MATH_ENGINE_NUMERIC_FIELD_INDEX_TIME_BUDGET_NS = 8,
    
  • math_engine_numeric_field_index_t.MATH_ENGINE_NUMERIC_FIELD_INDEX_MEMORY_BUDGET_BYTES

    field_sources 에서 memory-budget source를 찾는 index다.

    /** =field_sources=에서 memory-budget source를 찾는 index다. */
        MATH_ENGINE_NUMERIC_FIELD_INDEX_MEMORY_BUDGET_BYTES = 9,
    
  • math_engine_numeric_field_index_t.MATH_ENGINE_NUMERIC_FIELD_INDEX_COUNT

    field_sources 의 element 수이며 valid field index의 exclusive upper bound다.

    /** =field_sources=의 element 수이며 valid field index의 exclusive upper bound다. */
        MATH_ENGINE_NUMERIC_FIELD_INDEX_COUNT = 10,
    

math_engine_numeric_policy_layer_t

Domain별 partial numeric policy layer다. Length는 계산 좌표 unit, time tolerance는 second, angular tolerance는 radian, residual tolerance는 dimensionless다. time_budget_ns 는 0이 금지되고 UINT64_MAX 가 무제한이다. Memory 0은 allocation 금지다. present_fields 에 없는 모든 value field는 반드시 0이어야 하며 resolver가 읽지 않는다.

typedef struct math_engine_numeric_policy_layer {
    /** Exact ABI byte size; 반드시 =sizeof(math_engine_numeric_policy_layer_t)=이다. */
    uint32_t struct_size;
    /** =MATH_ENGINE_NUMERIC_POLICY_LAYER_VERSION_1=인 ABI version이다. */
    uint32_t struct_version;
    /** =MATH_ENGINE_NUMERIC_FIELD_*= 조합이며 그 밖 bit는 reserved다. */
    uint64_t present_fields;
    /** Present일 때 유효한 =math_engine_binary_rounding_t= 값, 아니면 0이다. */
    uint32_t binary_rounding;
    /** Present일 때 유효한 =math_engine_decimal_rounding_t= 값, 아니면 0이다. */
    uint32_t decimal_rounding;
    /** Version 1에서는 0이어야 하는 policy flag storage다. */
    uint32_t flags;
    /** Version 1에서는 0이어야 하는 alignment/future-use field다. */
    uint32_t reserved32;
    /** Present일 때 finite nonnegative absolute tolerance. 단위는 계산 좌표 unit이다. */
    double length_tolerance;
    /** Present일 때 finite nonnegative time tolerance. 단위는 second다. */
    double time_tolerance_seconds;
    /** Present일 때 finite nonnegative angular tolerance. 단위는 radian이다. */
    double angular_tolerance_radians;
    /** Present일 때 finite nonnegative convergence residual tolerance. 무차원이다. */
    double residual_tolerance;
    /** Present일 때 1 이상인 maximum algorithm iteration count, 아니면 0이다. */
    uint64_t iteration_budget;
    /** Present일 때 1 이상인 maximum function evaluation count, 아니면 0이다. */
    uint64_t evaluation_budget;
    /** Present일 때 1 이상인 wall-time budget. 단위는 ns이며 =UINT64_MAX=는 무제한이다. */
    uint64_t time_budget_ns;
    /** Present일 때 allocation ceiling byte 수. 0은 allocation 금지다. */
    uint64_t memory_budget_bytes;
    /** Version 1에서는 0이어야 하는 future-use field다. */
    uint64_t reserved64;
} math_engine_numeric_policy_layer_t;
  • math_engine_numeric_policy_layer_t.struct_size

    Exact ABI byte size; 반드시 sizeof(math_engine_numeric_policy_layer_t) 이다.

    /** Exact ABI byte size; 반드시 =sizeof(math_engine_numeric_policy_layer_t)=이다. */
        uint32_t struct_size;
    
  • math_engine_numeric_policy_layer_t.struct_version

    MATH_ENGINE_NUMERIC_POLICY_LAYER_VERSION_1 인 ABI version이다.

    /** =MATH_ENGINE_NUMERIC_POLICY_LAYER_VERSION_1=인 ABI version이다. */
        uint32_t struct_version;
    
  • math_engine_numeric_policy_layer_t.present_fields

    MATH_ENGINE_NUMERIC_FIELD_* 조합이며 그 밖 bit는 reserved다.

    /** =MATH_ENGINE_NUMERIC_FIELD_*= 조합이며 그 밖 bit는 reserved다. */
        uint64_t present_fields;
    
  • math_engine_numeric_policy_layer_t.binary_rounding

    Present일 때 유효한 math_engine_binary_rounding_t 값, 아니면 0이다.

    /** Present일 때 유효한 =math_engine_binary_rounding_t= 값, 아니면 0이다. */
        uint32_t binary_rounding;
    
  • math_engine_numeric_policy_layer_t.decimal_rounding

    Present일 때 유효한 math_engine_decimal_rounding_t 값, 아니면 0이다.

    /** Present일 때 유효한 =math_engine_decimal_rounding_t= 값, 아니면 0이다. */
        uint32_t decimal_rounding;
    
  • math_engine_numeric_policy_layer_t.flags

    Version 1에서는 0이어야 하는 policy flag storage다.

    /** Version 1에서는 0이어야 하는 policy flag storage다. */
        uint32_t flags;
    
  • math_engine_numeric_policy_layer_t.reserved32

    Version 1에서는 0이어야 하는 alignment/future-use field다.

    /** Version 1에서는 0이어야 하는 alignment/future-use field다. */
        uint32_t reserved32;
    
  • math_engine_numeric_policy_layer_t.length_tolerance

    Present일 때 finite nonnegative absolute tolerance. 단위는 계산 좌표 unit이다.

    /** Present일 때 finite nonnegative absolute tolerance. 단위는 계산 좌표 unit이다. */
        double length_tolerance;
    
  • math_engine_numeric_policy_layer_t.time_tolerance_seconds

    Present일 때 finite nonnegative time tolerance. 단위는 second다.

    /** Present일 때 finite nonnegative time tolerance. 단위는 second다. */
        double time_tolerance_seconds;
    
  • math_engine_numeric_policy_layer_t.angular_tolerance_radians

    Present일 때 finite nonnegative angular tolerance. 단위는 radian이다.

    /** Present일 때 finite nonnegative angular tolerance. 단위는 radian이다. */
        double angular_tolerance_radians;
    
  • math_engine_numeric_policy_layer_t.residual_tolerance

    Present일 때 finite nonnegative convergence residual tolerance. 무차원이다.

    /** Present일 때 finite nonnegative convergence residual tolerance. 무차원이다. */
        double residual_tolerance;
    
  • math_engine_numeric_policy_layer_t.iteration_budget

    Present일 때 1 이상인 maximum algorithm iteration count, 아니면 0이다.

    /** Present일 때 1 이상인 maximum algorithm iteration count, 아니면 0이다. */
        uint64_t iteration_budget;
    
  • math_engine_numeric_policy_layer_t.evaluation_budget

    Present일 때 1 이상인 maximum function evaluation count, 아니면 0이다.

    /** Present일 때 1 이상인 maximum function evaluation count, 아니면 0이다. */
        uint64_t evaluation_budget;
    
  • math_engine_numeric_policy_layer_t.time_budget_ns

    Present일 때 1 이상인 wall-time budget. 단위는 ns이며 UINT64_MAX 는 무제한이다.

    /** Present일 때 1 이상인 wall-time budget. 단위는 ns이며 =UINT64_MAX=는 무제한이다. */
        uint64_t time_budget_ns;
    
  • math_engine_numeric_policy_layer_t.memory_budget_bytes

    Present일 때 allocation ceiling byte 수. 0은 allocation 금지다.

    /** Present일 때 allocation ceiling byte 수. 0은 allocation 금지다. */
        uint64_t memory_budget_bytes;
    
  • math_engine_numeric_policy_layer_t.reserved64

    Version 1에서는 0이어야 하는 future-use field다.

    /** Version 1에서는 0이어야 하는 future-use field다. */
        uint64_t reserved64;
    

math_engine_resolved_numeric_policy_t

Resolver가 commit하는 pointer 없는 numeric policy value다. Finance-fixed 이외 mode에서는 네 tolerance 중 하나 이상이 양수여야 하고, iteration/evaluation/time budget은 모두 nonzero다.

typedef struct math_engine_resolved_numeric_policy {
    /** Exact ABI byte size인 =sizeof(math_engine_resolved_numeric_policy_t)=이다. */
    uint32_t struct_size;
    /** =MATH_ENGINE_RESOLVED_NUMERIC_POLICY_VERSION_1=인 ABI version이다. */
    uint32_t struct_version;
    /** 최종 선택된 유효 =math_engine_binary_rounding_t= 값이다. */
    uint32_t binary_rounding;
    /** 최종 선택된 유효 =math_engine_decimal_rounding_t= 값이다. */
    uint32_t decimal_rounding;
    /** Finite nonnegative absolute tolerance. 단위는 계산 좌표 unit이다. */
    double length_tolerance;
    /** Finite nonnegative time tolerance. 단위는 second다. */
    double time_tolerance_seconds;
    /** Finite nonnegative angular tolerance. 단위는 radian이다. */
    double angular_tolerance_radians;
    /** Finite nonnegative convergence residual tolerance. 무차원이다. */
    double residual_tolerance;
    /** 1 이상인 maximum algorithm iteration count다. */
    uint64_t iteration_budget;
    /** 1 이상인 maximum function evaluation count다. */
    uint64_t evaluation_budget;
    /** 1 이상인 wall-time budget. 단위는 ns이며 =UINT64_MAX=는 무제한이다. */
    uint64_t time_budget_ns;
    /** Allocation ceiling byte 수. 0은 allocation 금지다. */
    uint64_t memory_budget_bytes;
    /** Stable numeric-field index별 =math_engine_configuration_source_t= 10개다. */
    uint32_t field_sources[MATH_ENGINE_NUMERIC_FIELD_INDEX_COUNT];
    /** 모든 numeric value, source와 algorithm ID의 canonical fingerprint다. */
    uint64_t policy_fingerprint;
    /** =policy_fingerprint=에 사용한 algorithm ID이며 version 1 FNV-1a64다. */
    uint32_t fingerprint_algorithm;
    /** Version 1에서는 0이어야 하는 policy flag storage다. */
    uint32_t flags;
} math_engine_resolved_numeric_policy_t;
  • math_engine_resolved_numeric_policy_t.struct_size

    Exact ABI byte size인 sizeof(math_engine_resolved_numeric_policy_t) 이다.

    /** Exact ABI byte size인 =sizeof(math_engine_resolved_numeric_policy_t)=이다. */
        uint32_t struct_size;
    
  • math_engine_resolved_numeric_policy_t.struct_version

    MATH_ENGINE_RESOLVED_NUMERIC_POLICY_VERSION_1 인 ABI version이다.

    /** =MATH_ENGINE_RESOLVED_NUMERIC_POLICY_VERSION_1=인 ABI version이다. */
        uint32_t struct_version;
    
  • math_engine_resolved_numeric_policy_t.binary_rounding

    최종 선택된 유효 math_engine_binary_rounding_t 값이다.

    /** 최종 선택된 유효 =math_engine_binary_rounding_t= 값이다. */
        uint32_t binary_rounding;
    
  • math_engine_resolved_numeric_policy_t.decimal_rounding

    최종 선택된 유효 math_engine_decimal_rounding_t 값이다.

    /** 최종 선택된 유효 =math_engine_decimal_rounding_t= 값이다. */
        uint32_t decimal_rounding;
    
  • math_engine_resolved_numeric_policy_t.length_tolerance

    Finite nonnegative absolute tolerance. 단위는 계산 좌표 unit이다.

    /** Finite nonnegative absolute tolerance. 단위는 계산 좌표 unit이다. */
        double length_tolerance;
    
  • math_engine_resolved_numeric_policy_t.time_tolerance_seconds

    Finite nonnegative time tolerance. 단위는 second다.

    /** Finite nonnegative time tolerance. 단위는 second다. */
        double time_tolerance_seconds;
    
  • math_engine_resolved_numeric_policy_t.angular_tolerance_radians

    Finite nonnegative angular tolerance. 단위는 radian이다.

    /** Finite nonnegative angular tolerance. 단위는 radian이다. */
        double angular_tolerance_radians;
    
  • math_engine_resolved_numeric_policy_t.residual_tolerance

    Finite nonnegative convergence residual tolerance. 무차원이다.

    /** Finite nonnegative convergence residual tolerance. 무차원이다. */
        double residual_tolerance;
    
  • math_engine_resolved_numeric_policy_t.iteration_budget

    1 이상인 maximum algorithm iteration count다.

    /** 1 이상인 maximum algorithm iteration count다. */
        uint64_t iteration_budget;
    
  • math_engine_resolved_numeric_policy_t.evaluation_budget

    1 이상인 maximum function evaluation count다.

    /** 1 이상인 maximum function evaluation count다. */
        uint64_t evaluation_budget;
    
  • math_engine_resolved_numeric_policy_t.time_budget_ns

    1 이상인 wall-time budget. 단위는 ns이며 UINT64_MAX 는 무제한이다.

    /** 1 이상인 wall-time budget. 단위는 ns이며 =UINT64_MAX=는 무제한이다. */
        uint64_t time_budget_ns;
    
  • math_engine_resolved_numeric_policy_t.memory_budget_bytes

    Allocation ceiling byte 수. 0은 allocation 금지다.

    /** Allocation ceiling byte 수. 0은 allocation 금지다. */
        uint64_t memory_budget_bytes;
    
  • math_engine_resolved_numeric_policy_t.field_sources

    Stable numeric-field index별 math_engine_configuration_source_t 10개다.

    /** Stable numeric-field index별 =math_engine_configuration_source_t= 10개다. */
        uint32_t field_sources[MATH_ENGINE_NUMERIC_FIELD_INDEX_COUNT];
    
  • math_engine_resolved_numeric_policy_t.policy_fingerprint

    모든 numeric value, source와 algorithm ID의 canonical fingerprint다.

    /** 모든 numeric value, source와 algorithm ID의 canonical fingerprint다. */
        uint64_t policy_fingerprint;
    
  • math_engine_resolved_numeric_policy_t.fingerprint_algorithm

    policy_fingerprint 에 사용한 algorithm ID이며 version 1 FNV-1a64다.

    /** =policy_fingerprint=에 사용한 algorithm ID이며 version 1 FNV-1a64다. */
        uint32_t fingerprint_algorithm;
    
  • math_engine_resolved_numeric_policy_t.flags

    Version 1에서는 0이어야 하는 policy flag storage다.

    /** Version 1에서는 0이어야 하는 policy flag storage다. */
        uint32_t flags;
    

math_engine_resolved_context_t

Serialization과 replay에 사용하는 immutable resolved context value다.

typedef struct math_engine_resolved_context {
    /** Exact ABI byte size인 =sizeof(math_engine_resolved_context_t)=이다. */
    uint32_t struct_size;
    /** =MATH_ENGINE_RESOLVED_CONTEXT_VERSION_1=인 ABI version이다. */
    uint32_t struct_version;
    /** 자체 size/version/fingerprint가 유효한 embedded resolved configuration value다. */
    math_engine_resolved_configuration_t configuration;
    /** =configuration.mode=에 대해 유효한 embedded resolved numeric policy value다. */
    math_engine_resolved_numeric_policy_t numeric_policy;
    /** Replay identity에 포함되는 opaque dimensionless seed. 모든 64-bit 값이 유효하다. */
    uint64_t deterministic_seed;
    /** Version, 두 nested fingerprint, seed와 algorithm ID의 canonical fingerprint다. */
    uint64_t context_fingerprint;
    /** =context_fingerprint=에 사용한 algorithm ID이며 version 1 FNV-1a64다. */
    uint32_t fingerprint_algorithm;
    /** Version 1에서는 0이어야 하는 policy flag storage다. */
    uint32_t flags;
} math_engine_resolved_context_t;
  • math_engine_resolved_context_t.struct_size

    Exact ABI byte size인 sizeof(math_engine_resolved_context_t) 이다.

    /** Exact ABI byte size인 =sizeof(math_engine_resolved_context_t)=이다. */
        uint32_t struct_size;
    
  • math_engine_resolved_context_t.struct_version

    MATH_ENGINE_RESOLVED_CONTEXT_VERSION_1 인 ABI version이다.

    /** =MATH_ENGINE_RESOLVED_CONTEXT_VERSION_1=인 ABI version이다. */
        uint32_t struct_version;
    
  • math_engine_resolved_context_t.configuration

    자체 size/version/fingerprint가 유효한 embedded resolved configuration value다.

    /** 자체 size/version/fingerprint가 유효한 embedded resolved configuration value다. */
        math_engine_resolved_configuration_t configuration;
    
  • math_engine_resolved_context_t.numeric_policy

    configuration.mode 에 대해 유효한 embedded resolved numeric policy value다.

    /** =configuration.mode=에 대해 유효한 embedded resolved numeric policy value다. */
        math_engine_resolved_numeric_policy_t numeric_policy;
    
  • math_engine_resolved_context_t.deterministic_seed

    Replay identity에 포함되는 opaque dimensionless seed. 모든 64-bit 값이 유효하다.

    /** Replay identity에 포함되는 opaque dimensionless seed. 모든 64-bit 값이 유효하다. */
        uint64_t deterministic_seed;
    
  • math_engine_resolved_context_t.context_fingerprint

    Version, 두 nested fingerprint, seed와 algorithm ID의 canonical fingerprint다.

    /** Version, 두 nested fingerprint, seed와 algorithm ID의 canonical fingerprint다. */
        uint64_t context_fingerprint;
    
  • math_engine_resolved_context_t.fingerprint_algorithm

    context_fingerprint 에 사용한 algorithm ID이며 version 1 FNV-1a64다.

    /** =context_fingerprint=에 사용한 algorithm ID이며 version 1 FNV-1a64다. */
        uint32_t fingerprint_algorithm;
    
  • math_engine_resolved_context_t.flags

    Version 1에서는 0이어야 하는 policy flag storage다.

    /** Version 1에서는 0이어야 하는 policy flag storage다. */
        uint32_t flags;
    

Macro와 constant

MATH_ENGINE_CONFIGURATION_FIELD_DETERMINISTIC

Layer의 deterministic 0/1 값이 명시되었음을 나타낸다.

#define MATH_ENGINE_CONFIGURATION_FIELD_DETERMINISTIC (UINT64_C(1) << 2u)

MATH_ENGINE_CONFIGURATION_FIELD_MODE

Layer의 mode 값이 명시되었음을 나타낸다.

#define MATH_ENGINE_CONFIGURATION_FIELD_MODE (UINT64_C(1) << 0u)

MATH_ENGINE_CONFIGURATION_FIELD_PRECISION_BITS

Layer의 precision_bits 값이 명시되었음을 나타낸다.

#define MATH_ENGINE_CONFIGURATION_FIELD_PRECISION_BITS (UINT64_C(1) << 3u)

MATH_ENGINE_CONFIGURATION_FIELD_SCALAR_BACKEND

Layer의 scalar_backend 값이 명시되었음을 나타낸다.

#define MATH_ENGINE_CONFIGURATION_FIELD_SCALAR_BACKEND (UINT64_C(1) << 1u)

MATH_ENGINE_CONFIGURATION_FINGERPRINT_ALGORITHM_FNV1A64_V1

Canonical little-endian field sequence에 적용하는 version 1 FNV-1a 64-bit algorithm ID다.

#define MATH_ENGINE_CONFIGURATION_FINGERPRINT_ALGORITHM_FNV1A64_V1 UINT32_C(1)

MATH_ENGINE_CONFIGURATION_LAYER_VERSION_1

math_engine_configuration_layer_t 의 최초 ABI version 값이다.

#define MATH_ENGINE_CONFIGURATION_LAYER_VERSION_1 UINT32_C(1)

MATH_ENGINE_NUMERIC_FIELD_ANGULAR_TOLERANCE

Layer의 radian 단위 angular_tolerance_radians 가 명시되었음을 나타낸다.

#define MATH_ENGINE_NUMERIC_FIELD_ANGULAR_TOLERANCE (UINT64_C(1) << 4u)

MATH_ENGINE_NUMERIC_FIELD_BINARY_ROUNDING

Layer의 binary_rounding 값이 명시되었음을 나타낸다.

#define MATH_ENGINE_NUMERIC_FIELD_BINARY_ROUNDING (UINT64_C(1) << 0u)

MATH_ENGINE_NUMERIC_FIELD_DECIMAL_ROUNDING

Layer의 decimal_rounding 값이 명시되었음을 나타낸다.

#define MATH_ENGINE_NUMERIC_FIELD_DECIMAL_ROUNDING (UINT64_C(1) << 1u)

MATH_ENGINE_NUMERIC_FIELD_EVALUATION_BUDGET

Layer의 nonzero maximum evaluation count가 명시되었음을 나타낸다.

#define MATH_ENGINE_NUMERIC_FIELD_EVALUATION_BUDGET (UINT64_C(1) << 7u)

MATH_ENGINE_NUMERIC_FIELD_ITERATION_BUDGET

Layer의 nonzero maximum iteration count가 명시되었음을 나타낸다.

#define MATH_ENGINE_NUMERIC_FIELD_ITERATION_BUDGET (UINT64_C(1) << 6u)

MATH_ENGINE_NUMERIC_FIELD_LENGTH_TOLERANCE

Layer의 coordinate-unit length_tolerance 가 명시되었음을 나타낸다.

#define MATH_ENGINE_NUMERIC_FIELD_LENGTH_TOLERANCE (UINT64_C(1) << 2u)

MATH_ENGINE_NUMERIC_FIELD_MEMORY_BUDGET_BYTES

Layer의 allocation byte ceiling이 명시되었음을 나타낸다. 값 0도 유효하다.

#define MATH_ENGINE_NUMERIC_FIELD_MEMORY_BUDGET_BYTES (UINT64_C(1) << 9u)

MATH_ENGINE_NUMERIC_FIELD_RESIDUAL_TOLERANCE

Layer의 dimensionless residual_tolerance 가 명시되었음을 나타낸다.

#define MATH_ENGINE_NUMERIC_FIELD_RESIDUAL_TOLERANCE (UINT64_C(1) << 5u)

MATH_ENGINE_NUMERIC_FIELD_TIME_BUDGET_NS

Layer의 nonzero nanosecond budget가 명시되었음을 나타낸다.

#define MATH_ENGINE_NUMERIC_FIELD_TIME_BUDGET_NS (UINT64_C(1) << 8u)

MATH_ENGINE_NUMERIC_FIELD_TIME_TOLERANCE

Layer의 second 단위 time_tolerance_seconds 가 명시되었음을 나타낸다.

#define MATH_ENGINE_NUMERIC_FIELD_TIME_TOLERANCE (UINT64_C(1) << 3u)

MATH_ENGINE_NUMERIC_POLICY_LAYER_VERSION_1

math_engine_numeric_policy_layer_t 의 최초 ABI version 값이다.

#define MATH_ENGINE_NUMERIC_POLICY_LAYER_VERSION_1 UINT32_C(1)

MATH_ENGINE_RESOLVED_CONFIGURATION_VERSION_1

math_engine_resolved_configuration_t 의 최초 ABI version 값이다.

#define MATH_ENGINE_RESOLVED_CONFIGURATION_VERSION_1 UINT32_C(1)

MATH_ENGINE_RESOLVED_CONTEXT_VERSION_1

math_engine_resolved_context_t 의 최초 ABI version 값이다.

#define MATH_ENGINE_RESOLVED_CONTEXT_VERSION_1 UINT32_C(1)

MATH_ENGINE_RESOLVED_CONTEXT_WIRE_SIZE

Version 1 resolved-context canonical encoding의 정확한 byte 수인 240이다.

#define MATH_ENGINE_RESOLVED_CONTEXT_WIRE_SIZE UINT64_C(240)

MATH_ENGINE_RESOLVED_NUMERIC_POLICY_VERSION_1

math_engine_resolved_numeric_policy_t 의 최초 ABI version 값이다.

#define MATH_ENGINE_RESOLVED_NUMERIC_POLICY_VERSION_1 UINT32_C(1)

Function

math_engine_configuration_resolve

Partial layer를 field별 우선순위로 병합하고 capability와 충돌을 검증한다.

Layer pointer는 nullable이다. NULL 또는 field 미지정 시 build capability가 PC precision, 그 다음 game mode 순서로 기본값을 선택한다. 모든 실패에서 out_resolved 를 보존한다.

  • 매개변수 capabilities: 검증된 immutable capability snapshot.
  • 매개변수 product_default: nullable product-default layer.
  • 매개변수 session_profile: nullable session layer. 같은 field에서는 product default보다 우선한다.
  • 매개변수 explicit_call: nullable call layer. 같은 field에서는 가장 높은 우선순위다.
  • 매개변수 out_resolved: size/version을 설정한 caller output. 성공 시에만 한 번에 갱신한다.
  • 반환: 성공 시 OK. ABI 오류, 지원하지 않는 mode/backend 또는 precision 범위 오류에서는

output을 보존하고 해당 status를 반환한다.

  • Math Engine ownership: capabilities=borrowed product_default=borrowed session_profile=borrowed explicit_call=borrowed out_resolved=caller
  • Math Engine nullable: capabilities=false product_default=true session_profile=true explicit_call=true out_resolved=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_configuration_resolve(
    const math_engine_capability_descriptor_t* capabilities,
    const math_engine_configuration_layer_t* product_default,
    const math_engine_configuration_layer_t* session_profile,
    const math_engine_configuration_layer_t* explicit_call,
    math_engine_resolved_configuration_t* out_resolved);

math_engine_numeric_policy_resolve

Domain별 numeric layer를 같은 field 우선순위로 resolve한다.

  • 매개변수 mode: 기본 tolerance와 budget을 정하는 실행 mode.
  • 매개변수 product_default: nullable product-default numeric layer.
  • 매개변수 session_profile: nullable session numeric layer.
  • 매개변수 explicit_call: nullable call numeric layer.
  • 매개변수 out_policy: size/version을 설정한 caller output. 성공 시에만 commit된다.
  • 반환: 성공 시 OK. 각 tolerance는 header에 선언된 단위를 사용하며 non-finite·음수,

0 iteration/evaluation/time budget 또는 잘못된 ABI에서는 output을 보존한다.

  • Math Engine ownership: product_default=borrowed session_profile=borrowed explicit_call=borrowed out_policy=caller
  • Math Engine nullable: product_default=true session_profile=true explicit_call=true out_policy=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_numeric_policy_resolve(
    math_engine_mode_t mode,
    const math_engine_numeric_policy_layer_t* product_default,
    const math_engine_numeric_policy_layer_t* session_profile,
    const math_engine_numeric_policy_layer_t* explicit_call,
    math_engine_resolved_numeric_policy_t* out_policy);

math_engine_numeric_policy_validate

Mode와 resolved numeric policy의 unit/range/fingerprint를 검증한다.

  • 매개변수 mode: policy가 적용될 실행 mode.
  • 매개변수 policy: 검증할 immutable resolved policy.
  • 반환: 유효하면 OK. 잘못된 size/version, tolerance·budget·source 또는 fingerprint를

해당 status로 거부하며 입력을 변경하지 않는다.

  • Math Engine ownership: policy=borrowed
  • Math Engine nullable: policy=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_numeric_policy_validate(
    math_engine_mode_t mode,
    const math_engine_resolved_numeric_policy_t* policy);

math_engine_resolved_context_init

Resolved configuration/policy와 deterministic seed를 context로 commit한다.

  • 매개변수 configuration: 검증할 immutable resolved configuration.
  • 매개변수 numeric_policy: configuration mode와 일치해야 하는 immutable numeric policy.
  • 매개변수 deterministic_seed: replay fingerprint에 포함할 dimensionless seed.
  • 매개변수 out_context: size/version을 설정한 caller output. 성공 시에만 commit된다.
  • 반환: 성공 시 OK. 중첩 계약 또는 output ABI 오류에서는 out_context 를 보존한다.
  • Math Engine ownership: configuration=borrowed numeric_policy=borrowed out_context=caller
  • Math Engine nullable: configuration=false numeric_policy=false out_context=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_resolved_context_init(
    const math_engine_resolved_configuration_t* configuration,
    const math_engine_resolved_numeric_policy_t* numeric_policy,
    uint64_t deterministic_seed,
    math_engine_resolved_context_t* out_context);

math_engine_resolved_context_validate

Context header, nested fingerprint와 domain 계약을 검증한다.

  • 매개변수 context: 검증할 immutable resolved context.
  • 반환: 유효하면 OK. 입력은 모든 경로에서 변경하지 않는다.
  • Math Engine ownership: context=borrowed
  • Math Engine nullable: context=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_resolved_context_validate(
    const math_engine_resolved_context_t* context);

math_engine_resolved_context_encode

Context를 명시 endian의 240-byte canonical wire value로 encode한다.

  • 매개변수 context: 검증할 immutable context. Output과 overlap할 수 없다.
  • 매개변수 byte_order: canonical integer/IEEE-754 field byte order.
  • 매개변수 output: caller-owned byte span. 용량이 0이면 data가 NULL일 수 있다.
  • 매개변수 out_required_size: nullable required-size output. Output span과 alias할 수 없다.
  • 반환: 성공 시 OK. 작은 buffer는 content를 보존하고 required size만 갱신한다.

다른 실패에서는 output과 required-size output을 보존한다.

  • Math Engine ownership: context=borrowed output=caller out_required_size=caller
  • Math Engine nullable: context=false output=capacity_zero_only out_required_size=true
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_resolved_context_encode(
    const math_engine_resolved_context_t* context,
    math_engine_byte_order_t byte_order,
    math_engine_mutable_byte_span_t output,
    uint64_t* out_required_size);

math_engine_resolved_context_decode

Canonical wire value를 검증하고 caller context에 한 번에 commit한다.

  • 매개변수 input: 최소 MATH_ENGINE_RESOLVED_CONTEXT_WIRE_SIZE byte인 borrowed span.
  • 매개변수 byte_order: wire field를 해석할 byte order.
  • 매개변수 out_context: input과 overlap하지 않는 caller output.
  • 반환: 성공 시 OK. 작은 input, 손상된 nested fingerprint, 잘못된 ABI/byte order를

거부하며 모든 실패에서 out_context 를 보존한다.

  • Math Engine ownership: input=borrowed out_context=caller
  • Math Engine nullable: input=capacity_zero_only out_context=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_resolved_context_decode(
    math_engine_const_byte_span_t input,
    math_engine_byte_order_t byte_order,
    math_engine_resolved_context_t* out_context);