1
0
Fork 0
mirror of https://github.com/BLAKE3-team/BLAKE3 synced 2024-05-09 07:36:06 +02:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Inanna Malick 417f668fe8
Merge 0031abcebd into 0816badf3a 2024-04-24 15:29:20 +09:00
Javier Blazquez 0816badf3a fix Windows ARM64 build and detect ARM64EC as ARM64 2024-04-07 11:48:02 -04:00
Inanna Malick 0031abcebd allow for construction of hash in const fn context 2020-04-22 19:17:56 -07:00
3 changed files with 12 additions and 3 deletions

View File

@ -4,9 +4,12 @@
#include "blake3_impl.h"
#if defined(IS_X86)
#if defined(_MSC_VER)
#include <Windows.h>
#endif
#if defined(IS_X86)
#if defined(_MSC_VER)
#include <intrin.h>
#elif defined(__GNUC__)
#include <immintrin.h>

View File

@ -28,7 +28,7 @@ enum blake3_flags {
#define INLINE static inline __attribute__((always_inline))
#endif
#if defined(__x86_64__) || defined(_M_X64)
#if (defined(__x86_64__) || defined(_M_X64)) && !defined(_M_ARM64EC)
#define IS_X86
#define IS_X86_64
#endif
@ -38,7 +38,7 @@ enum blake3_flags {
#define IS_X86_32
#endif
#if defined(__aarch64__) || defined(_M_ARM64)
#if defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC)
#define IS_AARCH64
#endif

View File

@ -221,6 +221,12 @@ fn counter_high(counter: u64) -> u32 {
#[derive(Clone, Copy, Hash)]
pub struct Hash([u8; OUT_LEN]);
/// Provided to allow for construction of magic hash values (eg null commit in git as [0; OUT_LEN])
pub const fn construct_magic_hash(bytes: [u8; OUT_LEN]) -> Hash {
Hash(bytes)
}
impl Hash {
/// The raw bytes of the `Hash`. Note that byte arrays don't provide
/// constant-time equality checking, so if you need to compare hashes,