A loop continuouly runs 3Y/8. In intel processor, how to optimize the speed of this computation: 3Y/8

Recommended Answers

what is 3Y/8??

Jump to Post

All 2 Replies

what is 3Y/8??

If 3Y is an integer value (up to 64-bits), then to divide by 8 you can use a right-shift operator, shifting 3 places (2^3 == 8). IE,
int64_t result = ((3*Y) >> 3);
This won't work for floating point values, however.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.