Skip to content

Commit

Permalink
Rename default to generic
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Aug 28, 2023
1 parent fba4ca9 commit 34710dc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ cfg_if! {
mod x86;
use x86 as imp;
} else {
use default as imp;
use generic as imp;
}
}

Expand Down Expand Up @@ -628,7 +628,7 @@ fn encode_to_slice_inner<const UPPER: bool>(
Ok(())
}

mod default {
mod generic {
use super::*;

/// Default encoding function.
Expand Down
8 changes: 4 additions & 4 deletions src/portable_simd.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::default;
use crate::generic;
use core::simd::u8x16;
use core::slice;

Expand All @@ -13,7 +13,7 @@ pub(super) unsafe fn encode<const UPPER: bool>(input: &[u8], output: *mut u8) {
let mut i = 0;
let (prefix, chunks, suffix) = input.as_simd::<CHUNK_SIZE>();

default::encode::<UPPER>(prefix, output);
generic::encode::<UPPER>(prefix, output);
i += prefix.len() * 2;

let hex_table = u8x16::from_array(*crate::get_chars_table::<UPPER>());
Expand All @@ -36,7 +36,7 @@ pub(super) unsafe fn encode<const UPPER: bool>(input: &[u8], output: *mut u8) {
i += CHUNK_SIZE;
}

default::encode::<UPPER>(suffix, output.add(i));
generic::encode::<UPPER>(suffix, output.add(i));
}

pub(super) use default::decode;
pub(super) use generic::decode;
8 changes: 4 additions & 4 deletions src/x86.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::default;
use crate::generic;

#[cfg(target_arch = "x86")]
use core::arch::x86::*;
Expand All @@ -16,7 +16,7 @@ cpufeatures::new!(cpuid_ssse3, "sse2", "ssse3");
/// `output` must be a valid pointer to at least `2 * input.len()` bytes.
pub(super) unsafe fn encode<const UPPER: bool>(input: &[u8], output: *mut u8) {
if input.len() < CHUNK_SIZE || !cpuid_ssse3::get() {
return default::encode::<UPPER>(input, output);
return generic::encode::<UPPER>(input, output);
}

// Load table and construct masks.
Expand Down Expand Up @@ -50,8 +50,8 @@ pub(super) unsafe fn encode<const UPPER: bool>(input: &[u8], output: *mut u8) {
}

if !input_remainder.is_empty() {
default::encode::<UPPER>(input_remainder, output.add(i));
generic::encode::<UPPER>(input_remainder, output.add(i));
}
}

pub(super) use default::decode;
pub(super) use generic::decode;

0 comments on commit 34710dc

Please sign in to comment.