Help Center

Local Navigation

Optimizing division operations

Division operations can be slow on BlackBerry® devices because the processor does not have a hardware divide instruction.

When your code divides a positive number by two, use shift right by one (>> 1). Use the shift right (>>) only when you know that you are working with a positive value.

Code sample

int = width >> 1;


Was this information helpful? Send us your comments.