Forum Stats

  • 3,760,383 Users
  • 2,251,695 Discussions
  • 7,871,090 Comments

Discussions

Why integer division of constants is always performed in run-time?

Gennady Kuznetsov
Gennady Kuznetsov Member Posts: 4 Red Ribbon

Hi All!

Why java compiler always generates IDIV instruction to perform INTEGER division of integer LITERALS at run-time instead of evaluate it at compile time (as it do for FP division)? Is there any reason? Where this behavior is described in documentation (IMHO JLS and JVMS does not state anything).

BR, Gennadiy