From dfd94f03fb912dc5d4eed490bde59aeb590ab99b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 21 Mar 2026 20:39:31 +0000 Subject: [PATCH] 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 --- tinygltf_json.h | 3 ++- tmp.glb | Bin 0 -> 88 bytes 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 tmp.glb diff --git a/tinygltf_json.h b/tinygltf_json.h index c33f22f..f940681 100644 --- a/tinygltf_json.h +++ b/tinygltf_json.h @@ -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; diff --git a/tmp.glb b/tmp.glb new file mode 100644 index 0000000000000000000000000000000000000000..3042f8b402dce89a14906cff8f869e4f54a1a79f GIT binary patch literal 88 zcmYe#32|d$U|@&<{9 literal 0 HcmV?d00001