Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit c3b13e5

Browse files
committed
Add a check in the shared.rs that the function list is sorted
1 parent 3109ebe commit c3b13e5

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

crates/libm-macros/src/shared.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const ALL_OPERATIONS_NESTED: &[(FloatTy, Signature, Option<Signature>, &[&str])]
1818
None,
1919
&[
2020
"acosf", "acoshf", "asinf", "asinhf", "atanf", "atanhf", "cbrtf", "ceilf", "cosf",
21-
"coshf", "erff", "erfcf", "exp10f", "exp2f", "expf", "expm1f", "fabsf", "floorf",
21+
"coshf", "erfcf", "erff", "exp10f", "exp2f", "expf", "expm1f", "fabsf", "floorf",
2222
"j0f", "j1f", "lgammaf", "log10f", "log1pf", "log2f", "logf", "rintf", "roundf",
2323
"sinf", "sinhf", "sqrtf", "tanf", "tanhf", "tgammaf", "truncf", "y0f", "y1f",
2424
],
@@ -30,8 +30,8 @@ const ALL_OPERATIONS_NESTED: &[(FloatTy, Signature, Option<Signature>, &[&str])]
3030
None,
3131
&[
3232
"acos", "acosh", "asin", "asinh", "atan", "atanh", "cbrt", "ceil", "cos", "cosh",
33-
"erf", "erfc", "exp10", "exp2", "exp", "expm1", "fabs", "floor", "j0", "j1", "lgamma",
34-
"log10", "log1p", "log2", "log", "rint", "round", "sin", "sinh", "sqrt", "tan", "tanh",
33+
"erf", "erfc", "exp", "exp10", "exp2", "expm1", "fabs", "floor", "j0", "j1", "lgamma",
34+
"log", "log10", "log1p", "log2", "rint", "round", "sin", "sinh", "sqrt", "tan", "tanh",
3535
"tgamma", "trunc", "y0", "y1",
3636
],
3737
),
@@ -139,28 +139,28 @@ const ALL_OPERATIONS_NESTED: &[(FloatTy, Signature, Option<Signature>, &[&str])]
139139
FloatTy::F16,
140140
Signature { args: &[Ty::F16, Ty::I32], returns: &[Ty::F16] },
141141
None,
142-
&["scalbnf16", "ldexpf16"],
142+
&["ldexpf16", "scalbnf16"],
143143
),
144144
(
145145
// `(f32, i32) -> f32`
146146
FloatTy::F32,
147147
Signature { args: &[Ty::F32, Ty::I32], returns: &[Ty::F32] },
148148
None,
149-
&["scalbnf", "ldexpf"],
149+
&["ldexpf", "scalbnf"],
150150
),
151151
(
152152
// `(f64, i64) -> f64`
153153
FloatTy::F64,
154154
Signature { args: &[Ty::F64, Ty::I32], returns: &[Ty::F64] },
155155
None,
156-
&["scalbn", "ldexp"],
156+
&["ldexp", "scalbn"],
157157
),
158158
(
159159
// `(f128, i32) -> f128`
160160
FloatTy::F128,
161161
Signature { args: &[Ty::F128, Ty::I32], returns: &[Ty::F128] },
162162
None,
163-
&["scalbnf128", "ldexpf128"],
163+
&["ldexpf128", "scalbnf128"],
164164
),
165165
(
166166
// `(f32, &mut f32) -> f32` as `(f32) -> (f32, f32)`
@@ -312,6 +312,12 @@ pub static ALL_OPERATIONS: LazyLock<Vec<MathOpInfo>> = LazyLock::new(|| {
312312
};
313313
ret.push(api);
314314
}
315+
316+
if !names.is_sorted() {
317+
let mut sorted = (*names).to_owned();
318+
sorted.sort_unstable();
319+
panic!("names list is not sorted: {names:?}\nExpected: {sorted:?}");
320+
}
315321
}
316322

317323
ret.sort_by_key(|item| item.name);

0 commit comments

Comments
 (0)