Repository navigation
fix: take uint_least8_t in fxp_rescale for CHAR_BIT == 16 targets - #3
Merged
Merged
Conversation
C11 provides uint8_t only where an exact 8-bit type exists, so fxp.h failed to compile on targets with CHAR_BIT == 16, such as TI C2000. uint_least8_t exists everywhere and is the same type as uint8_t where that type exists, so callers need no change. Refs #2
Builds the library with -Dwerror=true on CGT 22.6.2 and 25.11.1, under both COFF and EABI, so code that assumes CHAR_BIT == 8 or a 32-bit int fails CI instead of reaching consumers. The installers are checksum-pinned and the installed toolchains cached; the guides now state the rule against exact 8-bit types. Refs #2
This was referenced Oct 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #2
What and why
fxp_rescale()declared its fractional-bit counts asuint8_t. C11 providesuint8_tonly where an exact 8-bit type exists, sofxp.hdid not compile on targets withCHAR_BIT == 16, such as TI C2000. That blocks fixedpoint-control's move onto fxp (aajll/fixedpoint-control#6 to #9) on its main target.fxp_rescaletakesuint_least8_t. Whereuint8_texists the two are the same type, so this is source- and ABI-compatible for existing callers. README, guide and CHANGELOG ([Unreleased]) follow.c2000job builds the library with-Dwerror=trueon CGT 22.6.2 and 25.11.1, under--abi=coffabiand--abi=eabi(C2000doubleis 32-bit under COFF and 64-bit under EABI, which matters forfxp_convert.c). Installers come from TI's public download server, are checked against pinned SHA-256 sums, and the installed toolchain is cached per version.uint8_t/int8_tin favour of theleasttypes.Audit for 16-bit
intBesides the exact-width type, I audited
src/for 16-bit-inthazards: unsuffixed literals at or above 2^15,1 << nonint, and narrow-type arithmetic that promotes toint. Every shift operates on afxp_wide_torfxp_calc_tcast, and the only plainunsigned intvalues hold shift counts belowFXP_WORD_BITS.cl2000 --issue_remarksreports nothing onfxp.corfxp_convert.c; a probe confirmed that it does flag an oversized1 << 20on this target.Evidence
-Dwerror=true, CGT 22.6.2 and 25.11.1,with_converttrue and falseuint8_trestoredidentifier "uint8_t" is undefined-z,lnk.cmd,libc.a), both CGTs, both ABIswith_convert=false)Limitations
The C2000 evidence is from compiling and linking. No C28x hardware or simulator is available, so the test programs were not executed on target. Running them on target remains a separate step.