Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request replaces numerous hardcoded magic numbers and hex values with symbolic AL and ALC constants throughout src/lib/libopenal.js to improve code readability and maintainability. To support this, the corresponding definitions were added to src/struct_info.json, and the generated metadata files were updated. Feedback on the changes suggests referencing ALC_NO_ERROR directly as a global constant instead of cDefs.ALC_NO_ERROR for consistency with other constants in the file.
| // ------------------------------------------------------ | ||
|
|
||
| _alcErr: 0, | ||
| _alcErr: cDefs.ALC_NO_ERROR, |
There was a problem hiding this comment.
For consistency with other AL_ and ALC_ constants in this file (such as AL_NO_ERROR on line 2205), ALC_NO_ERROR should be referenced directly as a global constant rather than via cDefs.ALC_NO_ERROR. Since ALC_NO_ERROR is exposed as a global variable by the Emscripten compiler, the cDefs. prefix is redundant.
_alcErr: ALC_NO_ERROR,…. NFC Replace hardcoded magic numbers in the OpenAL library with symbolic constants exposed via `struct_info`, adding 82 defines and rebaselining the affected dylink codesize expectation (+2 bytes from `FLT_MAX` formatting). This is part 9 of a 9-part series replacing hardcoded numeric constants across JS libraries and runtime code. Across the full series, 938 new defines are added to `struct_info` (534 -> 1,472), adding ~22 ms (~2.7%) to an uncached hello-world link (0 ms on cached builds). Split out from emscripten-core#28199
6ff1e5b to
3457d52
Compare
Replace hardcoded magic numbers in the OpenAL library with symbolic constants exposed via
struct_info, adding 82 defines and rebaselining the affected dylink codesize expectation (+2 bytes fromFLT_MAXformatting).This is part 9 of a 9-part series replacing hardcoded numeric constants across JS libraries and runtime code. Across the full series, 938 new defines are added to
struct_info(534 -> 1,472), adding ~22 ms (~2.7%) to an uncached hello-world link (0 ms on cached builds).Split out from #28199