Integer widening operators: some preliminary statistics.

Ruslan Shevchenko rssh at
Thu Apr 23 15:34:37 PDT 2009

Good day, Bruce.

Some data about integer widening operator:

3 checks was implemented:
 1. model check for expression like  ($x && 0xff) or (0xff &  $x) where $x
must have a type byte (original request). This check named as "widening
operator (semantics)"

2. syntax check for expression like  ($x && 0xff) or (0xff &  $x) where $x
can have any type. This check named as "widening operator (syntax)"

 Example of second but not first:
  public static short reverseBytes(short s) {
    return (short) (((s & 0xff) << 8) | ((s & 0xff00) >> 8));
       byte[] nounce = new byte[24];
        for (int i=0;i<8;i++)

3. count of all expressions with bitwise and. (names as all bit ands)

Than, results for jetty was:

all bit ands    :       121
widening operator (semantics)   :       10
widening operator (syntax)      :       20

// some other counts, to compare with:
rethrow clause  :       34
string in switch        :       19

hibernate does not use bitwise and at all.
gwt-users have 2 entries of syntax pattern (actually this is reverseBytes

Result for jdk I will publish tomorrow, when ones will be ready.

It was preliminary data (one from 3 packages use 'bitwise and') more
statistics and some analysis will be available throught few days (with
data about for-s and ERP in dataset).

 Best Regards !

More information about the coin-dev mailing list