@@ -332,26 +332,26 @@ double getDouble(const byte* buf, ByteOrder byteOrder) {
332332
333333long us2Data (byte* buf, uint16_t s, ByteOrder byteOrder) {
334334 if (byteOrder == littleEndian) {
335- buf[0 ] = static_cast <byte>(s & 0x00ff );
336- buf[1 ] = static_cast <byte>((s & 0xff00 ) >> 8 );
335+ buf[0 ] = static_cast <byte>(s & 0x00ffU );
336+ buf[1 ] = static_cast <byte>((s & 0xff00U ) >> 8 );
337337 } else {
338- buf[0 ] = static_cast <byte>((s & 0xff00 ) >> 8 );
339- buf[1 ] = static_cast <byte>(s & 0x00ff );
338+ buf[0 ] = static_cast <byte>((s & 0xff00U ) >> 8 );
339+ buf[1 ] = static_cast <byte>(s & 0x00ffU );
340340 }
341341 return 2 ;
342342}
343343
344344long ul2Data (byte* buf, uint32_t l, ByteOrder byteOrder) {
345345 if (byteOrder == littleEndian) {
346- buf[0 ] = static_cast <byte>(l & 0x000000ff );
347- buf[1 ] = static_cast <byte>((l & 0x0000ff00 ) >> 8 );
348- buf[2 ] = static_cast <byte>((l & 0x00ff0000 ) >> 16 );
349- buf[3 ] = static_cast <byte>((l & 0xff000000 ) >> 24 );
346+ buf[0 ] = static_cast <byte>(l & 0x000000ffU );
347+ buf[1 ] = static_cast <byte>((l & 0x0000ff00U ) >> 8 );
348+ buf[2 ] = static_cast <byte>((l & 0x00ff0000U ) >> 16 );
349+ buf[3 ] = static_cast <byte>((l & 0xff000000U ) >> 24 );
350350 } else {
351- buf[0 ] = static_cast <byte>((l & 0xff000000 ) >> 24 );
352- buf[1 ] = static_cast <byte>((l & 0x00ff0000 ) >> 16 );
353- buf[2 ] = static_cast <byte>((l & 0x0000ff00 ) >> 8 );
354- buf[3 ] = static_cast <byte>(l & 0x000000ff );
351+ buf[0 ] = static_cast <byte>((l & 0xff000000U ) >> 24 );
352+ buf[1 ] = static_cast <byte>((l & 0x00ff0000U ) >> 16 );
353+ buf[2 ] = static_cast <byte>((l & 0x0000ff00U ) >> 8 );
354+ buf[3 ] = static_cast <byte>(l & 0x000000ffU );
355355 }
356356 return 4 ;
357357}
@@ -379,26 +379,26 @@ long ur2Data(byte* buf, URational l, ByteOrder byteOrder) {
379379
380380long s2Data (byte* buf, int16_t s, ByteOrder byteOrder) {
381381 if (byteOrder == littleEndian) {
382- buf[0 ] = static_cast <byte>(s & 0x00ff );
383- buf[1 ] = static_cast <byte>((s & 0xff00 ) >> 8 );
382+ buf[0 ] = static_cast <byte>(s & 0x00ffU );
383+ buf[1 ] = static_cast <byte>((s & 0xff00U ) >> 8 );
384384 } else {
385- buf[0 ] = static_cast <byte>((s & 0xff00 ) >> 8 );
386- buf[1 ] = static_cast <byte>(s & 0x00ff );
385+ buf[0 ] = static_cast <byte>((s & 0xff00U ) >> 8 );
386+ buf[1 ] = static_cast <byte>(s & 0x00ffU );
387387 }
388388 return 2 ;
389389}
390390
391391long l2Data (byte* buf, int32_t l, ByteOrder byteOrder) {
392392 if (byteOrder == littleEndian) {
393- buf[0 ] = static_cast <byte>(l & 0x000000ff );
394- buf[1 ] = static_cast <byte>((l & 0x0000ff00 ) >> 8 );
395- buf[2 ] = static_cast <byte>((l & 0x00ff0000 ) >> 16 );
396- buf[3 ] = static_cast <byte>((l & 0xff000000 ) >> 24 );
393+ buf[0 ] = static_cast <byte>(l & 0x000000ffU );
394+ buf[1 ] = static_cast <byte>((l & 0x0000ff00U ) >> 8 );
395+ buf[2 ] = static_cast <byte>((l & 0x00ff0000U ) >> 16 );
396+ buf[3 ] = static_cast <byte>((l & 0xff000000U ) >> 24 );
397397 } else {
398- buf[0 ] = static_cast <byte>((l & 0xff000000 ) >> 24 );
399- buf[1 ] = static_cast <byte>((l & 0x00ff0000 ) >> 16 );
400- buf[2 ] = static_cast <byte>((l & 0x0000ff00 ) >> 8 );
401- buf[3 ] = static_cast <byte>(l & 0x000000ff );
398+ buf[0 ] = static_cast <byte>((l & 0xff000000U ) >> 24 );
399+ buf[1 ] = static_cast <byte>((l & 0x00ff0000U ) >> 16 );
400+ buf[2 ] = static_cast <byte>((l & 0x0000ff00U ) >> 8 );
401+ buf[3 ] = static_cast <byte>(l & 0x000000ffU );
402402 }
403403 return 4 ;
404404}
0 commit comments