Skip to content

Commit

Permalink
add some more casts
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Jan 27, 2025
1 parent 91cd2e0 commit aa046ef
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions simde/arm/neon/cvt_n.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ simde_vcvth_n_u16_f16(simde_float16_t a, const int n)
SIMDE_REQUIRE_CONSTANT_RANGE(n, 1, 16) {
return simde_vcvth_u16_f16(
simde_float16_from_float32(
simde_float16_to_float32(a) * HEDLEY_STATIC_CAST(simde_float32_t, (UINT64_C(1) << n))));
simde_float16_to_float32(a) * HEDLEY_STATIC_CAST(simde_float32_t, (UINT32_C(1) << n))));
}
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
#define simde_vcvth_n_u16_f16(a, n) vcvth_n_u16_f16(a, n)
Expand All @@ -61,7 +61,7 @@ simde_vcvth_n_f16_s16(int16_t a, const int n)
SIMDE_REQUIRE_CONSTANT_RANGE(n, 1, 16) {
return simde_float16_from_float32(
HEDLEY_STATIC_CAST(simde_float32_t,
HEDLEY_STATIC_CAST(simde_float64_t, a) / (UINT64_C(1) << n)));
HEDLEY_STATIC_CAST(simde_float64_t, a) / HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n))));
}
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
#define simde_vcvth_n_f16_s16(a, n) vcvth_n_f16_s16(a, n)
Expand All @@ -78,7 +78,7 @@ simde_vcvth_n_f16_u16(uint16_t a, const int n)
SIMDE_REQUIRE_CONSTANT_RANGE(n, 1, 16) {
return simde_float16_from_float32(
HEDLEY_STATIC_CAST(simde_float32_t,
HEDLEY_STATIC_CAST(simde_float64_t, a) / (UINT64_C(1) << n)));
HEDLEY_STATIC_CAST(simde_float64_t, a) / HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n))));
}
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
#define simde_vcvth_n_f16_u16(a, n) vcvth_n_f16_u16(a, n)
Expand Down Expand Up @@ -122,7 +122,7 @@ simde_float32_t
simde_vcvts_n_f32_s32(int32_t a, const int n)
SIMDE_REQUIRE_CONSTANT_RANGE(n, 1, 32) {
return HEDLEY_STATIC_CAST(simde_float32_t,
HEDLEY_STATIC_CAST(simde_float64_t, a) / (UINT64_C(1) << n));
HEDLEY_STATIC_CAST(simde_float64_t, a) / HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n)));
}
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
#define simde_vcvts_n_f32_s32(a, n) vcvts_n_f32_s32(a, n)
Expand All @@ -137,7 +137,7 @@ simde_float32_t
simde_vcvts_n_f32_u32(uint32_t a, const int n)
SIMDE_REQUIRE_CONSTANT_RANGE(n, 1, 32) {
return HEDLEY_STATIC_CAST(simde_float32_t,
HEDLEY_STATIC_CAST(simde_float64_t, a) / (UINT64_C(1) << n));
HEDLEY_STATIC_CAST(simde_float64_t, a) / HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n)));
}
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
#define simde_vcvts_n_f32_u32(a, n) vcvts_n_f32_u32(a, n)
Expand All @@ -151,7 +151,7 @@ SIMDE_FUNCTION_ATTRIBUTES
int64_t
simde_vcvtd_n_s64_f64(simde_float64_t a, const int n)
SIMDE_REQUIRE_CONSTANT_RANGE(n, 1, 64) {
return simde_vcvtd_s64_f64(a * ((n == 64) ? simde_math_pow(2, n) : UINT64_C(1) << n));
return simde_vcvtd_s64_f64(a * ((n == 64) ? simde_math_pow(2, n) : HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n))));
}
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
#define simde_vcvtd_n_s64_f64(a, n) vcvtd_n_s64_f64(a, n)
Expand All @@ -165,7 +165,7 @@ SIMDE_FUNCTION_ATTRIBUTES
uint64_t
simde_vcvtd_n_u64_f64(simde_float64_t a, const int n)
SIMDE_REQUIRE_CONSTANT_RANGE(n, 1, 64) {
return simde_vcvtd_u64_f64(a * ((n == 64) ? simde_math_pow(2, n) : UINT64_C(1) << n));
return simde_vcvtd_u64_f64(a * ((n == 64) ? simde_math_pow(2, n) : HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n))));
}
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
#define simde_vcvtd_n_u64_f64(a, n) vcvtd_n_u64_f64(a, n)
Expand All @@ -179,7 +179,7 @@ SIMDE_FUNCTION_ATTRIBUTES
simde_float64_t
simde_vcvtd_n_f64_s64(int64_t a, const int n)
SIMDE_REQUIRE_CONSTANT_RANGE(n, 1, 64) {
return HEDLEY_STATIC_CAST(simde_float64_t, a) / ((n == 64) ? simde_math_pow(2, n) : UINT64_C(1) << n);
return HEDLEY_STATIC_CAST(simde_float64_t, a) / ((n == 64) ? simde_math_pow(2, n) : HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n)));
}
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
#define simde_vcvtd_n_f64_s64(a, n) vcvtd_n_f64_s64(a, n)
Expand All @@ -193,7 +193,7 @@ SIMDE_FUNCTION_ATTRIBUTES
simde_float64_t
simde_vcvtd_n_f64_u64(uint64_t a, const int n)
SIMDE_REQUIRE_CONSTANT_RANGE(n, 1, 64) {
return HEDLEY_STATIC_CAST(simde_float64_t, a) / ((n == 64) ? simde_math_pow(2, n) : UINT64_C(1) << n);
return HEDLEY_STATIC_CAST(simde_float64_t, a) / ((n == 64) ? simde_math_pow(2, n) : HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n)));
}
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
#define simde_vcvtd_n_f64_u64(a, n) vcvtd_n_f64_u64(a, n)
Expand Down Expand Up @@ -234,7 +234,7 @@ simde_vcvt_n_s64_f64(simde_float64x1_t a, const int n)

SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
r_.values[i] = simde_vcvtd_s64_f64(a_.values[i] * ((n == 64) ? simde_math_pow(2, n) : UINT64_C(1) << n));
r_.values[i] = simde_vcvtd_s64_f64(a_.values[i] * ((n == 64) ? simde_math_pow(2, n) : HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n))));
}

return simde_int64x1_from_private(r_);
Expand Down Expand Up @@ -303,7 +303,7 @@ simde_vcvt_n_u64_f64(simde_float64x1_t a, const int n)

SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
r_.values[i] = simde_vcvtd_u64_f64(a_.values[i] * ((n == 64) ? simde_math_pow(2, n) : UINT64_C(1) << n));
r_.values[i] = simde_vcvtd_u64_f64(a_.values[i] * ((n == 64) ? simde_math_pow(2, n) : HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n))));
}

return simde_uint64x1_from_private(r_);
Expand Down Expand Up @@ -348,7 +348,7 @@ simde_vcvtq_n_s64_f64(simde_float64x2_t a, const int n)

SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
r_.values[i] = simde_vcvtd_s64_f64(a_.values[i] * ((n == 64) ? simde_math_pow(2, n) : UINT64_C(1) << n));
r_.values[i] = simde_vcvtd_s64_f64(a_.values[i] * ((n == 64) ? simde_math_pow(2, n) : HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n))));
}

return simde_int64x2_from_private(r_);
Expand Down Expand Up @@ -418,7 +418,7 @@ simde_vcvtq_n_u64_f64(simde_float64x2_t a, const int n)

SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
r_.values[i] = simde_vcvtd_u64_f64(a_.values[i] * ((n == 64) ? simde_math_pow(2, n) : UINT64_C(1) << n));
r_.values[i] = simde_vcvtd_u64_f64(a_.values[i] * ((n == 64) ? simde_math_pow(2, n) : HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n))));
}

return simde_uint64x2_from_private(r_);
Expand All @@ -441,7 +441,7 @@ simde_vcvt_n_f16_u16(simde_uint16x4_t a, const int n)

SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
r_.values[i] = simde_float16_from_float32(HEDLEY_STATIC_CAST(simde_float32, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / (UINT64_C(1) << n)));
r_.values[i] = simde_float16_from_float32(HEDLEY_STATIC_CAST(simde_float32, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n))));
}

return simde_float16x4_from_private(r_);
Expand All @@ -464,7 +464,7 @@ simde_vcvt_n_f16_s16(simde_int16x4_t a, const int n)

SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
r_.values[i] = simde_float16_from_float32(HEDLEY_STATIC_CAST(simde_float32_t, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / (UINT64_C(1) << n)));
r_.values[i] = simde_float16_from_float32(HEDLEY_STATIC_CAST(simde_float32_t, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n))));
}

return simde_float16x4_from_private(r_);
Expand All @@ -487,7 +487,7 @@ simde_vcvtq_n_f16_u16(simde_uint16x8_t a, const int n)

SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
r_.values[i] = simde_float16_from_float32(HEDLEY_STATIC_CAST(simde_float32_t, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / (UINT64_C(1) << n)));
r_.values[i] = simde_float16_from_float32(HEDLEY_STATIC_CAST(simde_float32_t, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n))));
}

return simde_float16x8_from_private(r_);
Expand All @@ -510,7 +510,7 @@ simde_vcvtq_n_f16_s16(simde_int16x8_t a, const int n)

SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
r_.values[i] = simde_float16_from_float32(HEDLEY_STATIC_CAST(simde_float32_t, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / (UINT64_C(1) << n)));
r_.values[i] = simde_float16_from_float32(HEDLEY_STATIC_CAST(simde_float32_t, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n))));
}

return simde_float16x8_from_private(r_);
Expand All @@ -533,7 +533,7 @@ simde_vcvt_n_f32_u32(simde_uint32x2_t a, const int n)

SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
r_.values[i] = HEDLEY_STATIC_CAST(simde_float32_t, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / (UINT64_C(1) << n));
r_.values[i] = HEDLEY_STATIC_CAST(simde_float32_t, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n)));
}

return simde_float32x2_from_private(r_);
Expand All @@ -555,7 +555,7 @@ simde_vcvt_n_f32_s32(simde_int32x2_t a, const int n)

SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
r_.values[i] = HEDLEY_STATIC_CAST(simde_float32_t, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / (UINT64_C(1) << n));
r_.values[i] = HEDLEY_STATIC_CAST(simde_float32_t, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n)));
}

return simde_float32x2_from_private(r_);
Expand All @@ -577,7 +577,7 @@ simde_vcvt_n_f64_u64(simde_uint64x1_t a, const int n)

SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
r_.values[i] = HEDLEY_STATIC_CAST(simde_float64_t, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / ((n == 64) ? simde_math_pow(2, n) : UINT64_C(1) << n));
r_.values[i] = HEDLEY_STATIC_CAST(simde_float64_t, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / ((n == 64) ? simde_math_pow(2, n) : HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n))));
}

return simde_float64x1_from_private(r_);
Expand All @@ -599,7 +599,7 @@ simde_vcvtq_n_f64_u64(simde_uint64x2_t a, const int n)

SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
r_.values[i] = HEDLEY_STATIC_CAST(simde_float64_t, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / ((n == 64) ? simde_math_pow(2, n) : UINT64_C(1) << n));
r_.values[i] = HEDLEY_STATIC_CAST(simde_float64_t, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / ((n == 64) ? simde_math_pow(2, n) : HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n))));
}

return simde_float64x2_from_private(r_);
Expand All @@ -621,7 +621,7 @@ simde_vcvt_n_f64_s64(simde_int64x1_t a, const int n)

SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
r_.values[i] = HEDLEY_STATIC_CAST(simde_float64_t, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / ((n == 64) ? simde_math_pow(2, n) : UINT64_C(1) << n));
r_.values[i] = HEDLEY_STATIC_CAST(simde_float64_t, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / ((n == 64) ? simde_math_pow(2, n) : HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n))));
}

return simde_float64x1_from_private(r_);
Expand All @@ -643,7 +643,7 @@ simde_vcvtq_n_f64_s64(simde_int64x2_t a, const int n)

SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
r_.values[i] = HEDLEY_STATIC_CAST(simde_float64_t, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / ((n == 64) ? simde_math_pow(2, n) : UINT64_C(1) << n));
r_.values[i] = HEDLEY_STATIC_CAST(simde_float64_t, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / ((n == 64) ? simde_math_pow(2, n) : HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n))));
}

return simde_float64x2_from_private(r_);
Expand All @@ -665,7 +665,7 @@ simde_vcvtq_n_f32_s32(simde_int32x4_t a, const int n)

SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
r_.values[i] = HEDLEY_STATIC_CAST(simde_float32_t, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / (UINT64_C(1) << n));
r_.values[i] = HEDLEY_STATIC_CAST(simde_float32_t, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n)));
}

return simde_float32x4_from_private(r_);
Expand All @@ -687,7 +687,7 @@ simde_vcvtq_n_f32_u32(simde_uint32x4_t a, const int n)

SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
r_.values[i] = HEDLEY_STATIC_CAST(simde_float32_t, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / (UINT64_C(1) << n));
r_.values[i] = HEDLEY_STATIC_CAST(simde_float32_t, HEDLEY_STATIC_CAST(simde_float64_t, a_.values[i]) / HEDLEY_STATIC_CAST(simde_float64_t, (UINT64_C(1) << n)));
}

return simde_float32x4_from_private(r_);
Expand Down

0 comments on commit aa046ef

Please sign in to comment.