[Device Function] Fix implementation of __bitinsert_u64

- It's a common mistake by assuming 1 << shamt would be promoted to
  64-bit, if shamt is a 64-bit integer. That's not the case. Replace
  that left shift to a 64-bit one to ensure it won't fall into undefined
  behavior.
- Fix the host-side implementation as well for device function testing.


[ROCm/clr commit: 2380eb8ecc]
Ta zmiana jest zawarta w:
%! (template.HTML=Michael LIAO)złożyło 2019-04-30 08:59:13 -04:00
1 rodzic fbadd3f6cd
złożenie eb43303d0b
2 plików zmienionych
+3 -3

Żadne pliki nie pasują do Twojego wyszukiwania

+1 -1
Wyświetl plik
@@ -46,7 +46,7 @@ T bit_insert(T src0, T src1, unsigned int src2, unsigned int src3) {
unsigned int bits = sizeof(T) * 8;
T offset = src2 & (bits - 1);
T width = src3 & (bits - 1);
T mask = (1 << width) - 1;
T mask = (((T)1) << width) - 1;
return ((src0 & ~(mask << offset)) | ((src1 & mask) << offset));
}