Fix cj_dbl_to_i64 comment to accurately describe clamping behavior

Co-authored-by: syoyo <18676+syoyo@users.noreply.github.com>
Agent-Logs-Url: https://github.com/syoyo/tinygltf/sessions/74f01d98-ca42-4950-984e-458d4e3eeccd
This commit is contained in:
copilot-swe-agent[bot]
2026-03-21 20:39:31 +00:00
parent 131c4489fa
commit dfd94f03fb
2 changed files with 2 additions and 1 deletions

View File

@@ -308,7 +308,8 @@ static const char *cj_scan_str(const char *p, const char *end) {
* Breaks strict JSON/IEEE-754-double conformance.
* ====================================================================== */
/* Safe double-to-int64 cast: clamp inf/NaN/out-of-range to 0. */
/* Safe double-to-int64 cast: returns 0 for NaN; clamps +inf/out-of-range-high
* to INT64_MAX and -inf/out-of-range-low to INT64_MIN. */
static int64_t cj_dbl_to_i64(double d) {
if (d != d) return 0; /* NaN */
if (d >= (double)INT64_MAX) return INT64_MAX;

BIN
tmp.glb Normal file

Binary file not shown.