Skip to content

Commit

Permalink
Tweak aarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Aug 29, 2023
1 parent 851bcf5 commit 06c484d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/aarch64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,17 @@ pub(super) unsafe fn encode<const UPPER: bool>(input: &[u8], output: *mut u8) {
return generic::encode::<UPPER>(input, output);
}

// Load table and construct masks.
// Load table.
let hex_table = vld1q_u8(super::get_chars_table::<UPPER>().as_ptr());
let mask_lo = vdupq_n_u8(0x0F);

let input_chunks = input.chunks_exact(CHUNK_SIZE);
let input_remainder = input_chunks.remainder();

let mut i = 0;
for input_chunk in input_chunks {
// Load input bytes and mask to nibbles.
let input_bytes = vld1q_u8(input_chunk.as_ptr() as *const u8);
let mut lo = vandq_u8(input_bytes, mask_lo);
let input_bytes = vld1q_u8(input_chunk.as_ptr());
let mut lo = vandq_u8(input_bytes, vdupq_n_u8(0x0F));
let mut hi = vshrq_n_u8(input_bytes, 4);

// Lookup the corresponding ASCII hex digit for each nibble.
Expand Down

0 comments on commit 06c484d

Please sign in to comment.