Skip to content

Commit

Permalink
Align doubles to 8 bytes in the StandardMessageCodec (flutter#3779)
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-simmons authored and tvolkert committed Jun 16, 2017
1 parent f741647 commit ab2bc15
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ static void writeValue(ByteArrayOutputStream stream, Object value) {
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);
Expand Down Expand Up @@ -305,6 +306,7 @@ static Object readValue(ByteBuffer buffer) {
break;
}
case DOUBLE:
readAlignment(buffer, 8);
result = buffer.getDouble();
break;
case STRING: {
Expand Down

0 comments on commit ab2bc15

Please sign in to comment.