1) In a debug build, copy_nonoverlapping with a NULL source and a 0 len will crash with an assertion. This possibly only happens on mac. Fix is to put an if around it to only call if len > 0.
2) Bitshifts that shift all the way to 0 are failing with an overflow assert. The assert is "attempt to shift right with overflow". Breaking it up into the shift - 1 and then a shift of 1 avoids this. This makes zero sense. I originally thought it was a bug introduced in the nightly toolchain but I can reproduce it in stable. Now i think its always been there but its very hard to activate- you have to have the bitmap in the PMA be exactly 0x800.0000. This causes next_chunk=trailing zeros to be 31 and so it shifts it by next_chunk+1=32, so all the way to 0.
This fixes two weird bugs on mac:
1) In a debug build, copy_nonoverlapping with a NULL source and a 0 len will crash with an assertion. This possibly only happens on mac. Fix is to put an if around it to only call if len > 0. 2) Bitshifts that shift all the way to 0 are failing with an overflow assert. The assert is "attempt to shift right with overflow". Breaking it up into the shift - 1 and then a shift of 1 avoids this. This makes zero sense. I originally thought it was a bug introduced in the nightly toolchain but I can reproduce it in stable. Now i think its always been there but its very hard to activate- you have to have the bitmap in the PMA be exactly 0x800.0000. This causes next_chunk=trailing zeros to be 31 and so it shifts it by next_chunk+1=32, so all the way to 0.