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:
authorJP Aumasson <jeanphilippe.aumasson@gmail.com>2016-10-28 10:29:15 +0300
committerGitHub <noreply@github.com>2016-10-28 10:29:15 +0300
commitd4418edab4b9e7595973f876f82d9fecf54b9d19 (patch)
tree7b741a8899f3e070400368e38e87cab35466718b /ref/blake2-impl.h
parentc314fb42d4bafa0577de5a7d04c944ad175819c1 (diff)
parent5522bb232553e3d50affc7859df16a1dee0d652e (diff)
Merge pull request #35 from BLAKE2/b2x
B2x
Diffstat (limited to 'ref/blake2-impl.h')
-rw-r--r--ref/blake2-impl.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/ref/blake2-impl.h b/ref/blake2-impl.h
index 03df0b5..ad9089e 100644
--- a/ref/blake2-impl.h
+++ b/ref/blake2-impl.h
@@ -64,6 +64,30 @@ 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)
+ memcpy(dst, &w, sizeof w);
+#else
+ uint8_t *p = ( uint8_t * )dst;
+ *p++ = ( uint8_t )w; w >>= 8;
+ *p++ = ( uint8_t )w;
+#endif
+}
+
static BLAKE2_INLINE void store32( void *dst, uint32_t w )
{
#if defined(NATIVE_LITTLE_ENDIAN)