ref: cf068aafd605d9c5b77c5dfd65b2963a51c145a1
parent: ca4c89314abff54e3806b44e4a08164f8204f09a
author: mjvk <29380294+mjvk@users.noreply.github.com>
date: Wed May 9 07:47:06 EDT 2018
Update cast of load16 Bitwise operations promote the cast to uint16_t to int. So to be consistent, first cast to uint to keep unsignedness and prevent implicit promotion. Then cast back to uint16_t after all bitwise operations are completed. This prevents compiler warnings, unneccessary casts and in the case of right shifting (not the case here) unexpected behaviour.
--- a/sse/blake2-impl.h
+++ b/sse/blake2-impl.h
@@ -72,8 +72,8 @@
return w;
#else
const uint8_t *p = ( const uint8_t * )src;
- return (( uint16_t )( p[0] ) << 0) |
- (( uint16_t )( p[1] ) << 8) ;
+ return ( uint16_t )((( uint32_t )( p[0] ) << 0) |
+ (( uint32_t )( p[1] ) << 8));
#endif
}
--
⑨