3 ms·
Correct. Java's >>> is unsigned, since it's a logical shift, but there's no corresponding unsigned division. Here's a clearer example of how GCC handles the di
by Scaevolus 9y ago
Correct. Java's >>> is unsigned, since it's a logical shift, but there's no corresponding unsigned division.
Here's a clearer example of how GCC handles the different cases of signed vs unsigned division and shifting: https://godbolt.org/g/glC97v https://godbolt.org/g/glC97v
Note that the signed division is the most expensive, but it still doesn't resort to a full divide instruction.