Skip to content

Make meshopt_quantizeHalf/Float extern "C"#840

Merged
zeux merged 1 commit intomasterfrom
cquant
Feb 6, 2025
Merged

Make meshopt_quantizeHalf/Float extern "C"#840
zeux merged 1 commit intomasterfrom
cquant

Conversation

@zeux
Copy link
Owner

@zeux zeux commented Feb 5, 2025

meshopt_quantizeHalf/Float were initially inline C++ functions but were later converted to proper functions in quantization.cpp; however, they were still in the "inline C++" block that was not under extern "C". This makes it harder to access these functions via FFI, so this change moves them, as well as meshopt_dequantizeHalf, into extern "C" block which changes the function mangling to C.

meshopt_quantizeUnorm/Snorm remain inline; this is necessary both for performance, as inlining them with a constant N produces much more efficient code, and because they are used in some meshopt algorithm implementations, and by convention every translation unit in meshoptimizer library must be self-contained for ease of compilation.

See #838.

meshopt_quantizeHalf/Float were initially inline C++ functions but were
later converted to proper functions in quantization.cpp; however, they
were still in the "inline C++" block that was not under extern "C". This
makes it harder to access these functions via FFI, so this change moves
them into extern "C" block which changes the function mangling to C.

meshopt_quantizeUnorm/Snorm remain inline; this is necessary both for
performance, as inlining them with a constant N produces much more
efficient code, and because they are used in some meshopt algorithm
implementations, and by convention every translation unit in
meshoptimizer library must be self-contained for ease of compilation.
@zeux zeux merged commit 7044538 into master Feb 6, 2025
13 checks passed
@zeux zeux deleted the cquant branch February 6, 2025 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant