Support building solana-program on 32-bit architectures that do not (#21577)
have 64-bit atomics by using a Mutex<u64> on 32-bit architectures. Currently the usage of atomics are only in functions that support tests and benchmarks.
This commit is contained in:
@@ -104,11 +104,11 @@ impl Hash {
|
||||
|
||||
/// unique Hash for tests and benchmarks.
|
||||
pub fn new_unique() -> Self {
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
use crate::atomic_u64::AtomicU64;
|
||||
static I: AtomicU64 = AtomicU64::new(1);
|
||||
|
||||
let mut b = [0u8; HASH_BYTES];
|
||||
let i = I.fetch_add(1, Ordering::Relaxed);
|
||||
let i = I.fetch_add(1);
|
||||
b[0..8].copy_from_slice(&i.to_le_bytes());
|
||||
Self::new(&b)
|
||||
}
|
||||
|
Reference in New Issue
Block a user