Skip to content

Replace arithmetic ops with bitwise shifts in FastMath - #677

Open
Ameer-5-5 wants to merge 1 commit into
MDTechLabs:mainfrom
Ameer-5-5:fixissue
Open

Replace arithmetic ops with bitwise shifts in FastMath#677
Ameer-5-5 wants to merge 1 commit into
MDTechLabs:mainfrom
Ameer-5-5:fixissue

Conversation

@Ameer-5-5

@Ameer-5-5 Ameer-5-5 commented Jul 28, 2026

Copy link
Copy Markdown

Closes #663


#663
Use bitwise shift operations (<< 1, >> 2, & 7) instead of explicit arithmetic (* 2, / 4, % 8) in the new FastMath library to save gas.

  • mul2: x * 2 → x << 1
  • div4: x / 4 → x >> 2
  • mod8: x % 8 → x & 7

Each bitwise op saves ~2 gas vs its arithmetic counterpart.

Use bitwise shift operations (<< 1, >> 2, & 7) instead of explicit
arithmetic (* 2, / 4, % 8) in the new FastMath library to save gas.

- mul2: x * 2 → x << 1
- div4: x / 4 → x >> 2
- mod8: x % 8 → x & 7

Each bitwise op saves ~2 gas vs its arithmetic counterpart.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CORE] Implement Zero-Memory-Expansion Multicall Engine

1 participant