1
votes

I found out that the CPU provides parity information after arithmetic (and other) instructions. Is this information in any way accessible in java so that you don't have to calculate this manually? Even though it is just a minor speedup nowadays, it would be wasteful if it wasn't possible to use it in java.

1
No, it isn't. Java defines its own virtual machine that is not tied to any particular CPU. You can detect carries and borrows in normal Java arithmetic using various techniques.President James K. Polk
@JamesKPolk why is parity not part of the java lang api, it has great value, for instance in networking. It doesn't matter if it takes a few more clock cycles (3 for a byte if the cpu supports SIMD) if the cpu doesn't support it natively, but at least providing a native API would make sure that the x64 implementation of the JVM could make use of the feature.Rik Schaaf
I don't see any significant value to it, least of all in networking.President James K. Polk
@JamesKPolk it is used for error detection using a checkbit that can be checked with a parity check. Even in hamming implementations it can be useful.Rik Schaaf

1 Answers

0
votes

no: it's not accessible in java