From fde1241ce928d38c2031c827ae0ddee5c6f5af0f Mon Sep 17 00:00:00 2001 From: Mark Rowe Date: Thu, 4 Jun 2026 16:36:52 -0700 Subject: Add abs, min, and max instructions --- binaryninjaapi.h | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'binaryninjaapi.h') diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 82da9ea6..5afc8a42 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -15069,6 +15069,60 @@ namespace BinaryNinja { */ ExprId CountLeadingSigns(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation()); + /*! Signed minimum of expressions \c left and \c right of size \c size potentially setting flags + + \param size The size of the result in bytes + \param left The left expression + \param right The right expression + \param flags Flags to set + \param loc Optional IL Location this expression was added from. + \return The expression mins.{}(left, right) + */ + ExprId MinSigned(size_t size, ExprId left, ExprId right, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation()); + + /*! Signed maximum of expressions \c left and \c right of size \c size potentially setting flags + + \param size The size of the result in bytes + \param left The left expression + \param right The right expression + \param flags Flags to set + \param loc Optional IL Location this expression was added from. + \return The expression maxs.{}(left, right) + */ + ExprId MaxSigned(size_t size, ExprId left, ExprId right, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation()); + + /*! Unsigned minimum of expressions \c left and \c right of size \c size potentially setting flags + + \param size The size of the result in bytes + \param left The left expression + \param right The right expression + \param flags Flags to set + \param loc Optional IL Location this expression was added from. + \return The expression minu.{}(left, right) + */ + ExprId MinUnsigned(size_t size, ExprId left, ExprId right, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation()); + + /*! Unsigned maximum of expressions \c left and \c right of size \c size potentially setting flags + + \param size The size of the result in bytes + \param left The left expression + \param right The right expression + \param flags Flags to set + \param loc Optional IL Location this expression was added from. + \return The expression maxu.{}(left, right) + */ + ExprId MaxUnsigned(size_t size, ExprId left, ExprId right, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation()); + + /*! Signed absolute value of expression \c value of size \c size potentially setting flags + + \param size The size of the result in bytes + \param a The expression to take the absolute value of + \param flags Flags to set + \param loc Optional IL Location this expression was added from. + \return The expression abs.{}(value) + */ + ExprId AbsoluteValue(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation()); + /*! Two's complement sign-extends the expression in \c value to \c size bytes \param size The size of the result in bytes @@ -15955,6 +16009,11 @@ namespace BinaryNinja { ExprId CountTrailingZeros(size_t size, ExprId src, const ILSourceLocation& loc = ILSourceLocation()); ExprId ReverseBits(size_t size, ExprId src, const ILSourceLocation& loc = ILSourceLocation()); ExprId CountLeadingSigns(size_t size, ExprId src, const ILSourceLocation& loc = ILSourceLocation()); + ExprId MinSigned(size_t size, ExprId left, ExprId right, const ILSourceLocation& loc = ILSourceLocation()); + ExprId MaxSigned(size_t size, ExprId left, ExprId right, const ILSourceLocation& loc = ILSourceLocation()); + ExprId MinUnsigned(size_t size, ExprId left, ExprId right, const ILSourceLocation& loc = ILSourceLocation()); + ExprId MaxUnsigned(size_t size, ExprId left, ExprId right, const ILSourceLocation& loc = ILSourceLocation()); + ExprId AbsoluteValue(size_t size, ExprId src, const ILSourceLocation& loc = ILSourceLocation()); ExprId SignExtend(size_t size, ExprId src, const ILSourceLocation& loc = ILSourceLocation()); ExprId ZeroExtend(size_t size, ExprId src, const ILSourceLocation& loc = ILSourceLocation()); ExprId LowPart(size_t size, ExprId src, const ILSourceLocation& loc = ILSourceLocation()); @@ -16362,6 +16421,11 @@ namespace BinaryNinja { ExprId CountTrailingZeros(size_t size, ExprId src, const ILSourceLocation& loc = ILSourceLocation()); ExprId ReverseBits(size_t size, ExprId src, const ILSourceLocation& loc = ILSourceLocation()); ExprId CountLeadingSigns(size_t size, ExprId src, const ILSourceLocation& loc = ILSourceLocation()); + ExprId MinSigned(size_t size, ExprId left, ExprId right, const ILSourceLocation& loc = ILSourceLocation()); + ExprId MaxSigned(size_t size, ExprId left, ExprId right, const ILSourceLocation& loc = ILSourceLocation()); + ExprId MinUnsigned(size_t size, ExprId left, ExprId right, const ILSourceLocation& loc = ILSourceLocation()); + ExprId MaxUnsigned(size_t size, ExprId left, ExprId right, const ILSourceLocation& loc = ILSourceLocation()); + ExprId AbsoluteValue(size_t size, ExprId src, const ILSourceLocation& loc = ILSourceLocation()); ExprId SignExtend(size_t size, ExprId src, const ILSourceLocation& loc = ILSourceLocation()); ExprId ZeroExtend(size_t size, ExprId src, const ILSourceLocation& loc = ILSourceLocation()); ExprId LowPart(size_t size, ExprId src, const ILSourceLocation& loc = ILSourceLocation()); -- cgit v1.3.1