Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UINT32 m_color1_mask;
- UINT32 m_color2_mask;
- #define ARRAY_LENGTH(x) (sizeof(x) / sizeof(x[0]))
- PALETTE_INIT( montecar )
- {
- static const UINT8 colortable_source[] =
- {
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x02, 0x00, 0x03,
- 0x03, 0x03, 0x03, 0x02,
- 0x03, 0x01, 0x03, 0x00,
- 0x00, 0x00, 0x02, 0x00,
- 0x02, 0x01, 0x02, 0x02,
- 0x00, 0x10, 0x20, 0x30,
- 0x00, 0x04, 0x08, 0x0c,
- 0x00, 0x44, 0x48, 0x4c,
- 0x00, 0x84, 0x88, 0x8c,
- 0x00, 0xc4, 0xc8, 0xcc
- };
- ...
- for (i = 0; i < ARRAY_LENGTH(colortable_source); i++)
- {
- UINT8 color = colortable_source[i];
- if (color == 1)
- state->m_color1_mask |= 1 << i; <<<---
- else if (color == 2)
- state->m_color2_mask |= 1 << i; <<<---
- prom_to_palette(machine, i,
- color_prom[0x100 + colortable_source[i]]);
- }
- ...
- }
- This suspicious code was found in MAME project by PVS-Studio static code analyzer.
- Warning message is:
- V610 Undefined behavior. Check the shift operator '<<. The right operand ('i' = [0..43]) is greater than or equal to the length in bits of the promoted left operand. firetrk.c 111
- PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment