提交 baa3f731 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Use Bits for INT and LONG to BYTES conversion

上级 66b00c96
...@@ -890,26 +890,14 @@ public abstract class Value { ...@@ -890,26 +890,14 @@ public abstract class Value {
}); });
} }
case INT: { case INT: {
int x = getInt(); byte[] b = new byte[4];
return ValueBytes.getNoCopy(new byte[]{ Bits.writeInt(b, 0, getInt());
(byte) (x >> 24), return ValueBytes.getNoCopy(b);
(byte) (x >> 16),
(byte) (x >> 8),
(byte) x
});
} }
case LONG: { case LONG: {
long x = getLong(); byte[] b = new byte[8];
return ValueBytes.getNoCopy(new byte[]{ Bits.writeLong(b, 0, getLong());
(byte) (x >> 56), return ValueBytes.getNoCopy(b);
(byte) (x >> 48),
(byte) (x >> 40),
(byte) (x >> 32),
(byte) (x >> 24),
(byte) (x >> 16),
(byte) (x >> 8),
(byte) x
});
} }
case ENUM: case ENUM:
case TIMESTAMP_TZ: case TIMESTAMP_TZ:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论