Skip to content

Commit

Permalink
chore: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Sep 29, 2024
1 parent 4b45669 commit 005150c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/arch/wasm32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use super::generic;
use crate::get_chars_table;
use core::arch::wasm32::*;

pub(crate) const USE_CHECK_FN: bool = false;
pub(crate) const USE_CHECK_FN: bool = true;

#[inline(always)]
fn has_simd128() -> bool {
Expand Down
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,8 @@ fn decode_to_slice_inner(input: &[u8], output: &mut [u8]) -> Result<(), FromHexE
/// Assumes `output.len() == input.len() / 2`.
#[inline]
unsafe fn decode_checked(input: &[u8], output: &mut [u8]) -> Result<(), FromHexError> {
debug_assert_eq!(output.len(), input.len() / 2);

if imp::USE_CHECK_FN {
// check then decode
if imp::check(input) {
Expand All @@ -628,7 +630,7 @@ unsafe fn decode_checked(input: &[u8], output: &mut [u8]) -> Result<(), FromHexE
#[inline]
const fn byte2hex<const UPPER: bool>(byte: u8) -> (u8, u8) {
let table = get_chars_table::<UPPER>();
let high = table[((byte & 0xf0) >> 4) as usize];
let high = table[(byte >> 4) as usize];
let low = table[(byte & 0x0f) as usize];
(high, low)
}
Expand Down

0 comments on commit 005150c

Please sign in to comment.