Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/BLAKE2/BLAKE2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'ref/blake2-impl.h')
-rw-r--r--ref/blake2-impl.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/ref/blake2-impl.h b/ref/blake2-impl.h
index f8c7e75..ad9089e 100644
--- a/ref/blake2-impl.h
+++ b/ref/blake2-impl.h
@@ -64,6 +64,19 @@ static BLAKE2_INLINE uint64_t load64( const void *src )
#endif
}
+static BLAKE2_INLINE uint16_t load16( const void *src )
+{
+#if defined(NATIVE_LITTLE_ENDIAN)
+ uint16_t w;
+ memcpy(&w, src, sizeof w);
+ return w;
+#else
+ const uint8_t *p = ( const uint8_t * )src;
+ return (( uint16_t )( p[0] ) << 0) |
+ (( uint16_t )( p[1] ) << 8) ;
+#endif
+}
+
static BLAKE2_INLINE void store16( void *dst, uint16_t w )
{
#if defined(NATIVE_LITTLE_ENDIAN)