how to divide the given number by 3 using bitwise operators and what are other methods without using /,*,%.operators..
srinivasdama
2
Newbie Poster
Recommended Answers
Jump to Postint y = (x * 43691) >> 17;
works for all unsigned ints x (32-bit) that are less than 98303.
And you can implement the multiplication using bitwise operators too... (note that 43691 == 0xaaab, or 1010101010101011 in binary, and the reason this works is that …
All 4 Replies
Nick Evan
4,005
Industrious Poster
Team Colleague
Featured Poster
Rashakil Fol
978
Super Senior Demiposter
Team Colleague
Nick Evan
4,005
Industrious Poster
Team Colleague
Featured Poster
Rashakil Fol
978
Super Senior Demiposter
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.