diff --git a/stdlib/src/builtin/uint.mojo b/stdlib/src/builtin/uint.mojo index 9c744052df..89b1286ffe 100644 --- a/stdlib/src/builtin/uint.mojo +++ b/stdlib/src/builtin/uint.mojo @@ -379,6 +379,15 @@ struct UInt(IntLike, _HashableWithHasher): """ return __mlir_op.`index.or`(self.value, rhs.value) + @always_inline("nodebug") + fn __invert__(self) -> UInt: + """Return ~self. + + Returns: + The ~self value. + """ + return self ^ Self.MAX + # ===----------------------------------------------------------------------===# # In place operations. # ===----------------------------------------------------------------------===#