mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-03 12:21:23 +00:00
Unsigned types in Java now return bigger size signed types.
(Java doesn't support unsigned types). ubyte/ushort return as int uint returns as long (all with correct masking) ulong still returns as long, as before. Tested: on Linux & Windows. Bug 17521464 Change-Id: Id6bc8f38fc8c1a2f4e6733c6980dc6b6e322b452
This commit is contained in:
@@ -15,19 +15,23 @@ public class Stat extends Table {
|
||||
public String id() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; }
|
||||
public ByteBuffer idAsByteBuffer() { return __vector_as_bytebuffer(4, 1); }
|
||||
public long val() { int o = __offset(6); return o != 0 ? bb.getLong(o + bb_pos) : 0; }
|
||||
public int count() { int o = __offset(8); return o != 0 ? bb.getShort(o + bb_pos) & 0xFFFF : 0; }
|
||||
|
||||
public static int createStat(FlatBufferBuilder builder,
|
||||
int id,
|
||||
long val) {
|
||||
builder.startObject(2);
|
||||
long val,
|
||||
int count) {
|
||||
builder.startObject(3);
|
||||
Stat.addVal(builder, val);
|
||||
Stat.addId(builder, id);
|
||||
Stat.addCount(builder, count);
|
||||
return Stat.endStat(builder);
|
||||
}
|
||||
|
||||
public static void startStat(FlatBufferBuilder builder) { builder.startObject(2); }
|
||||
public static void startStat(FlatBufferBuilder builder) { builder.startObject(3); }
|
||||
public static void addId(FlatBufferBuilder builder, int idOffset) { builder.addOffset(0, idOffset, 0); }
|
||||
public static void addVal(FlatBufferBuilder builder, long val) { builder.addLong(1, val, 0); }
|
||||
public static void addCount(FlatBufferBuilder builder, int count) { builder.addShort(2, (short)(count & 0xFFFF), 0); }
|
||||
public static int endStat(FlatBufferBuilder builder) {
|
||||
int o = builder.endObject();
|
||||
return o;
|
||||
|
||||
Reference in New Issue
Block a user