Re: [PATCH v2] hw/misc: use extract64 instead of 1 << i

2025-03-11 Thread Тигран Согомонян
04/02/25 15:24, Тигран Согомонян пишет: 27/12/24 18:16, Richard Henderson пишет: On 12/27/24 02:46, Tigran Sogomonian wrote: 1 << i is casted to uint64_t while bitwise and with val. So this value may become 0x8000 but only 31th "start" bit is required. Use the

Re: [PATCH v2] hw/misc: use extract64 instead of 1 << i

2025-02-04 Thread Тигран Согомонян
27/12/24 18:16, Richard Henderson пишет: On 12/27/24 02:46, Tigran Sogomonian wrote: 1 << i is casted to uint64_t while bitwise and with val. So this value may become 0x8000 but only 31th "start" bit is required. Use the bitfield extract() API instead. Again, I < 32.  There is no o

Re: [PATCH v2] hw/misc: use extract64 instead of 1 << i

2025-02-04 Thread Тигран Согомонян
27/12/24 18:16, Richard Henderson пишет: On 12/27/24 02:46, Tigran Sogomonian wrote: 1 << i is casted to uint64_t while bitwise and with val. So this value may become 0x8000 but only 31th "start" bit is required. Use the bitfield extract() API instead. Again, I < 32.  There is no o

Re: [PATCH] hw/misc: cast nand_getio value to uint64_t

2024-12-27 Thread Тигран Согомонян
27/12/24 01:49, Alex Bennée пишет: Tigran Sogomonian writes: s->buswidth = nand_flash_ids[s->chip_id].width >> 3; <= 16 >> 3 <= 2. x <= s->ioaddr[offset] << (s->buswidth << 3) <= max_uint8_t << 16 With x << 24 overflow is possible. Other cases are similar. Thus, need to cast return value to ui