galloc
galloc copied to clipboard
Panic in 32bit environment
I'm trying to use galloc on a 32bit arm microcontroller. When initializing, the library panicked at 'attempt to subtract with overflow' at this line.
I did some debugging and I think I found the reason:
-
MIN_ALIGNMENT_LOG2is the trailing zeros ofMIN_ALIGNMENT, which has a minimum of 8. -
largest_power_of_2_that_divides_addrcomes fromaddr + HEADER_SIZE, whichaddris aligned butHEADER_SIZEis not aligned due to its use ofusizein the 32bit environment. - This causes 2 - 3 and triggers the panic.
I'd love to help testing the crate again if you make changes.