mesa/src/util/format
Jeff Burnett 320d757578 util: Don't force 64-bit division on 32-bit platforms
When converting between snorm and between unorm values, the following
patch introduced 64-bit division on all platforms.

  util: Add and use functions to calculate min and max int for a size
  Commit hash: 72259a870f

The following unit math
  // local MAX_UINT macro based on UINT32_MAX
  (uint64_t * uint32_t + uint32_t) / uint32_t
changed to
  // macros.h inlined 'uint64_t u_uintN_max()' functions.
  (uint64_t * uint64_t + uint32_t) / uint64_t

This can significantly impact performance on 32-bit platforms.

Address this by type-casting the return values from the inlined
functions to avoid the 64-bit divide on 32-bit platforms.

Signed-off-by: Micah Shennum <micah.shennum@garmin.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39001>
2026-01-05 20:52:24 +00:00
..
format_utils.h util: Don't force 64-bit division on 32-bit platforms 2026-01-05 20:52:24 +00:00
meson.build
texcompress_bptc_tmp.h
texcompress_etc_tmp.h
texcompress_s3tc_tmp.h build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
u_format.c util/format: Autogen type conversion helpers 2025-09-15 10:59:04 +00:00
u_format.h util/format: Autogen type conversion helpers 2025-09-15 10:59:04 +00:00
u_format.yaml mesa: Add R16G16_R16B16_UNORM and related formats 2025-11-04 22:28:03 +00:00
u_format_bptc.c
u_format_bptc.h
u_format_etc.c
u_format_etc.h
u_format_fxt1.c
u_format_fxt1.h
u_format_latc.c
u_format_latc.h
u_format_other.c
u_format_other.h
u_format_pack.py util: fix msvc build warning 4146 (unary minus operator applied to unsigned type, result still unsigned) 2025-05-09 16:34:00 +00:00
u_format_parse.py util/format: Use more descriptive names for YUV formats 2025-08-20 14:01:07 +00:00
u_format_rgtc.c
u_format_rgtc.h
u_format_s3tc.c
u_format_s3tc.h
u_format_table.py mesa: Add R16G16_R16B16_UNORM and related formats 2025-11-04 22:28:03 +00:00
u_format_tests.c
u_format_tests.h
u_format_unpack_neon.c
u_format_yuv.c util/format: Add subsampling info to our YUV-as-RGB format names 2025-08-20 14:01:07 +00:00
u_format_yuv.h util/format: Add subsampling info to our YUV-as-RGB format names 2025-08-20 14:01:07 +00:00
u_format_zs.c util/format: Add a Z24_UNORM_PACKED format 2025-09-15 10:59:04 +00:00
u_format_zs.h util/format: Add a Z24_UNORM_PACKED format 2025-09-15 10:59:04 +00:00
u_formats.h ac,radeonsi: move SX PS downconversion code into ac_formats.c 2026-01-02 16:46:20 +00:00