[Mlir-commits] [mlir] [MLIR][Python] Remove partial LLVM APIs in python bindings (5/n) (PR #180644)
Jakub Kuderski
llvmlistbot at llvm.org
Tue Feb 10 07:18:15 PST 2026
================
@@ -122,6 +122,46 @@ subsequent processing.
type or if the buffer does not meet expectations.
)";
+namespace {
+/// Local helper checking if the current machine is little endian.
+bool isLittleEndian() {
+ const uint16_t value = 1;
+ unsigned char first_byte = 0;
+ std::memcpy(&first_byte, &value, 1);
+ return first_byte == 1;
+}
+
+/// Local helper adapted from llvm::scope_exit.
+template <typename Callable>
----------------
kuhar wrote:
llvm prefers `static` for internal functions over placing them in anonymous namespaces: https://llvm.org/docs/CodingStandards.html#restrict-visibility
```suggestion
/// Local helper checking if the current machine is little endian.
static bool isLittleEndian() {
const uint16_t value = 1;
unsigned char first_byte = 0;
std::memcpy(&first_byte, &value, 1);
return first_byte == 1;
}
namespace {
/// Local helper adapted from llvm::scope_exit.
template <typename Callable>
```
https://github.com/llvm/llvm-project/pull/180644
More information about the Mlir-commits
mailing list