Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#FFcccc
private final int BUFSIZE = 512;
// ...
nblocks = 1 + ((nbytes - 1) >> 9);  /*/ BUFSIZE = 512 = 2^9 */

The programmer has assumed that BUFSIZE is 512, and right-shifting 9 bits is the same (for positive numbers) as dividing by 512. However, if BUFSIZE changes to 1024 in the future, modifications will be difficult and error-prone.

...