@@ -5172,16 +5172,16 @@ uint16_t mode_2Dgameoflife(void) { // Written by Ewoud Wijma, inspired by https:
51725172 const uint16_t cols = SEGMENT.virtualWidth ();
51735173 const uint16_t rows = SEGMENT.virtualHeight ();
51745174 const size_t dataSize = ((SEGMENT.length () + 7 ) / 8 ); // round up to nearest byte
5175- const size_t detectionSize = sizeof (uint8_t ) + sizeof ( uint16_t )* 2 ; // 1 uint8_t (gliderLen), 2 uint16_t (2 CRCs)
5176- const size_t totalSize = dataSize * 2 + detectionSize + sizeof (uint8_t );
5175+ const size_t detectionSize = sizeof (uint16_t ) * 3 ; // 2 CRCs, gliderLength
5176+ const size_t totalSize = dataSize * 2 + detectionSize + sizeof (uint8_t ); // detectionSize + prevPalette
51775177
51785178 if (!SEGENV.allocateData (totalSize)) return mode_static (); // allocation failed
51795179 byte *cells = reinterpret_cast <byte*>(SEGENV.data );
51805180 byte *futureCells = reinterpret_cast <byte*>(SEGENV.data + dataSize);
5181- uint8_t *gliderLength = reinterpret_cast <uint8_t *>(SEGENV.data + dataSize* 2 );
5182- uint16_t *oscillatorCRC = reinterpret_cast <uint16_t *>(SEGENV.data + dataSize* 2 + sizeof (uint8_t ));
5183- uint16_t *spaceshipCRC = reinterpret_cast <uint16_t *>(SEGENV.data + dataSize* 2 + sizeof (uint8_t ) + sizeof (uint16_t ));
5184- uint8_t *prevPalette = reinterpret_cast <uint8_t *>(SEGENV.data + dataSize* 2 + detectionSize);
5181+ uint16_t *gliderLength = reinterpret_cast <uint16_t *>(SEGENV.data + dataSize * 2 );
5182+ uint16_t *oscillatorCRC = reinterpret_cast <uint16_t *>(SEGENV.data + dataSize * 2 + sizeof (uint8_t ));
5183+ uint16_t *spaceshipCRC = reinterpret_cast <uint16_t *>(SEGENV.data + dataSize * 2 + sizeof (uint8_t ) + sizeof (uint16_t ));
5184+ uint8_t *prevPalette = reinterpret_cast <uint8_t *>(SEGENV.data + dataSize * 2 + detectionSize);
51855185
51865186 uint16_t &generation = SEGENV.aux0 ; // Rename SEGENV/SEGMENT variables for readability
51875187 bool allColors = SEGMENT.check1 ;
@@ -5234,7 +5234,7 @@ uint16_t mode_2Dgameoflife(void) { // Written by Ewoud Wijma, inspired by https:
52345234 return FRAMETIME;
52355235 }
52365236
5237- bool blurDead = SEGENV.step > strip.now && blur && !bgBlendMode && !overlayBG;
5237+ bool blurDead = SEGENV.step > strip.now && blur && !bgBlendMode && !overlayBG;
52385238 bool palChanged = SEGMENT.palette != *prevPalette && !allColors;
52395239 if (palChanged) *prevPalette = SEGMENT.palette ;
52405240
0 commit comments