Align doubles to 8 bytes in the StandardMessageCodec (#3779)

See https://github.com/flutter/flutter/issues/10701
This commit is contained in:
Jason Simmons 2017-06-15 21:15:25 -07:00 committed by Todd Volkert
parent f741647d49
commit ab2bc15fcc

View File

@ -192,6 +192,7 @@ public final class StandardMessageCodec implements MessageCodec<Object> {
writeLong(stream, (long) value);
} else if (value instanceof Float || value instanceof Double) {
stream.write(DOUBLE);
writeAlignment(stream, 8);
writeDouble(stream, ((Number) value).doubleValue());
} else if (value instanceof BigInteger) {
stream.write(BIGINT);
@ -305,6 +306,7 @@ public final class StandardMessageCodec implements MessageCodec<Object> {
break;
}
case DOUBLE:
readAlignment(buffer, 8);
result = buffer.getDouble();
break;
case STRING: {