public static int readSizeT(Pointer ptr) {
    // TODO(scottb): make not public.
    if (SIZE_T_CLASS == SizeT4.class) {
      int result;
      result = ptr.getInt(0);
      assert result >= 0;
      return result;
    } else {
      long result = ptr.getLong(0);
      assert result >= 0;
      assert result < Integer.MAX_VALUE;
      return (int) result;
    }
  }
public static int readSizeT ( Pointer ptr ) { if ( SIZE_T_CLASS == SizeT4 . class ) { int result ; result = ptr . getInt ( 0 ) ; assert result >= 0 ; return result ; } else { long result = ptr . getLong ( 0 ) ; assert result >= 0 ; assert result < Integer . MAX_VALUE ; return ( int ) result ; } }
Helper method to read the value of a (size_t*), depends on {@code sizeof(size_t)}.