Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix simde_math_fpclass functions so they work. #1277

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions simde/simde-math.h
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ simde_math_fpclassf(float v, const int imm8) {
fu.f = v;
uint32_t bits = fu.u;
uint8_t NegNum = (bits >> 31) & 1;
uint32_t const ExpMask = 0x3F800000; // [30:23]
uint32_t const ExpMask = 0x7F800000; // [30:23]
uint32_t const MantMask = 0x007FFFFF; // [22:0]
uint8_t ExpAllOnes = ((bits & ExpMask) == ExpMask);
uint8_t ExpAllZeros = ((bits & ExpMask) == 0);
Expand All @@ -471,14 +471,14 @@ simde_math_fpclassf(float v, const int imm8) {
uint8_t Denorm_res = ExpAllZeros & (!MantAllZeros);
uint8_t FinNeg_res = NegNum & (!ExpAllOnes) & (!ZeroNumber);
uint8_t sNaN_res = ExpAllOnes & (!MantAllZeros) & (!SignalingBit);
result = (((imm8 >> 0) & qNaN_res) | \
((imm8 >> 1) & Pzero_res) | \
((imm8 >> 2) & Nzero_res) | \
((imm8 >> 3) & Pinf_res) | \
((imm8 >> 4) & Ninf_res) | \
((imm8 >> 5) & Denorm_res) | \
((imm8 >> 6) & FinNeg_res) | \
((imm8 >> 7) & sNaN_res));
result = ((((imm8 >> 0) & qNaN_res) ? SIMDE_MATH_FP_QNAN : 0) | \
(((imm8 >> 1) & Pzero_res) ? SIMDE_MATH_FP_PZERO : 0) | \
(((imm8 >> 2) & Nzero_res) ? SIMDE_MATH_FP_NZERO : 0) | \
(((imm8 >> 3) & Pinf_res) ? SIMDE_MATH_FP_PINF : 0) | \
(((imm8 >> 4) & Ninf_res) ? SIMDE_MATH_FP_NINF : 0) | \
(((imm8 >> 5) & Denorm_res) ? SIMDE_MATH_FP_DENORMAL : 0) | \
(((imm8 >> 6) & FinNeg_res) ? SIMDE_MATH_FP_NEGATIVE : 0) | \
(((imm8 >> 7) & sNaN_res) ? SIMDE_MATH_FP_SNAN : 0)) ;
return result;
}

Expand Down Expand Up @@ -509,14 +509,14 @@ simde_math_fpclass(double v, const int imm8) {
uint8_t Denorm_res = ExpAllZeros & (!MantAllZeros);
uint8_t FinNeg_res = NegNum & (!ExpAllOnes) & (!ZeroNumber);
uint8_t sNaN_res = ExpAllOnes & (!MantAllZeros) & (!SignalingBit);
result = (((imm8 >> 0) & qNaN_res) | \
((imm8 >> 1) & Pzero_res) | \
((imm8 >> 2) & Nzero_res) | \
((imm8 >> 3) & Pinf_res) | \
((imm8 >> 4) & Ninf_res) | \
((imm8 >> 5) & Denorm_res) | \
((imm8 >> 6) & FinNeg_res) | \
((imm8 >> 7) & sNaN_res));
result = ((((imm8 >> 0) & qNaN_res) ? SIMDE_MATH_FP_QNAN : 0) | \
(((imm8 >> 1) & Pzero_res) ? SIMDE_MATH_FP_PZERO : 0) | \
(((imm8 >> 2) & Nzero_res) ? SIMDE_MATH_FP_NZERO : 0) | \
(((imm8 >> 3) & Pinf_res) ? SIMDE_MATH_FP_PINF : 0) | \
(((imm8 >> 4) & Ninf_res) ? SIMDE_MATH_FP_NINF : 0) | \
(((imm8 >> 5) & Denorm_res) ? SIMDE_MATH_FP_DENORMAL : 0) | \
(((imm8 >> 6) & FinNeg_res) ? SIMDE_MATH_FP_NEGATIVE : 0) | \
(((imm8 >> 7) & sNaN_res) ? SIMDE_MATH_FP_SNAN : 0)) ;
return result;
}

Expand Down
Loading