Say I use this code to swap little with big endian, where *rp is a unsigned short *:
*rp = (*rp & 0xff00u) >> 8 | (*rp & 0x00ffu) << 8;
Result:
remark #810: conversion from "unsigned int" to "unsigned short" may lose significant bits
(with arrow pointing to the assignment)
At first I thought it saw the literal as an int, but then I replaced the expression by *rp & *rp and got the same error.
So, what gives? I didn't find any mention on the Web that bitwise ops upconverted to ints or unsigned ints.
Bug? Bitwise ops on shorts upconvert to ints and warning
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione


