Skip to content

Commit 7abc5d2

Browse files
committed
Review requests
1 parent f101e4c commit 7abc5d2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

usermods/user_fx/user_fx.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static uint16_t mode_diffusionfire(void) {
2424
const uint8_t spark_rate = SEGMENT.intensity;
2525
const uint8_t turbulence = SEGMENT.custom2;
2626

27-
unsigned dataSize = SEGMENT.length() + (cols * sizeof(uint16_t));
27+
unsigned dataSize = SEGMENT.length() + (cols * sizeof(uint16_t)) + 1;
2828
if (!SEGENV.allocateData(dataSize))
2929
return mode_static(); // allocation failed
3030

@@ -35,9 +35,10 @@ static uint16_t mode_diffusionfire(void) {
3535
}
3636

3737
if ((strip.now - SEGENV.step) >= refresh_ms) {
38-
// Reserve one extra byte and align to 2-byte boundary to avoid hard-faults
3938
uint8_t *bufStart = SEGMENT.data + SEGMENT.length();
40-
uintptr_t aligned = (uintptr_t(bufStart) + 1u) & ~uintptr_t(0x1u);
39+
// Reserve one extra byte and align to 2-byte boundary to avoid hard-faults
40+
uintptr_t addr = reinterpret_cast<uintptr_t>(bufStart);
41+
uintptr_t aligned = (addr + 1) & ~1;
4142
uint16_t *tmp_row = reinterpret_cast<uint16_t *>(aligned);
4243
SEGENV.step = strip.now;
4344
call++;

0 commit comments

Comments
 (0)