Skip to content

[Loopring 3.6] uint96 safe math #1758

@dong77

Description

@dong77

In many places in our code base, there are conventions between uint96 and uint256, and after some add/sub, we don't check if the ended values are still in the uint96 range.

I propose to add these two methods to make sure addition/subtraction between uint96 and uint256 are handled correctly.

    function add96(
        uint96 a,
        uint256 b
        )
        internal
        pure
        returns (uint96 c)
    {
      ...
    }

    function sub96(
        uint96 a,
        uint256 b
        )
        internal
        pure
        returns (uint96 c)
    {
      ...
    }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions