TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Looks like people are slowly forgetting about the modulus operator

4 pointsby narmakabout 7 years ago

1 comment

WeEatnKidabout 7 years ago
This particular use case (checking odd or even) doesn't even need to use the modulus operation -- which is expensive. A bitwise AND is much more efficient (provided that the compiler doesn't apply that optimization upon seeing % 2)