mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-21 16:35:45 +00:00
Reduced force_align in tests to 8, to work with --object-api.
More detail: https://github.com/google/flatbuffers/projects/6#card-17401359 See also the .md changes in this commit. Change-Id: Idfa68b2fd3bdb19979833737d3a3cf83ec1d6775
This commit is contained in:
@@ -28,7 +28,7 @@ public struct Vec3 : IFlatbufferObject
|
||||
public Test Test3 { get { return (new Test()).__assign(__p.bb_pos + 26, __p.bb); } }
|
||||
|
||||
public static Offset<Vec3> CreateVec3(FlatBufferBuilder builder, float X, float Y, float Z, double Test1, Color Test2, short test3_A, sbyte test3_B) {
|
||||
builder.Prep(16, 32);
|
||||
builder.Prep(8, 32);
|
||||
builder.Pad(2);
|
||||
builder.Prep(2, 4);
|
||||
builder.Pad(1);
|
||||
|
||||
@@ -63,7 +63,7 @@ func (rcv *Vec3) Test3(obj *Test) *Test {
|
||||
}
|
||||
|
||||
func CreateVec3(builder *flatbuffers.Builder, x float32, y float32, z float32, test1 float64, test2 int8, test3_a int16, test3_b int8) flatbuffers.UOffsetT {
|
||||
builder.Prep(16, 32)
|
||||
builder.Prep(8, 32)
|
||||
builder.Pad(2)
|
||||
builder.Prep(2, 4)
|
||||
builder.Pad(1)
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.google.flatbuffers.*;
|
||||
public Test test3(Test obj) { return obj.__assign(bb_pos + 26, bb); }
|
||||
|
||||
public static int createVec3(FlatBufferBuilder builder, float x, float y, float z, double test1, byte test2, short test3_a, byte test3_b) {
|
||||
builder.prep(16, 32);
|
||||
builder.prep(8, 32);
|
||||
builder.pad(2);
|
||||
builder.prep(2, 4);
|
||||
builder.pad(1);
|
||||
|
||||
@@ -35,7 +35,7 @@ function Vec3_mt:Test3(obj)
|
||||
return obj
|
||||
end
|
||||
function Vec3.CreateVec3(builder, x, y, z, test1, test2, test3_a, test3_b)
|
||||
builder:Prep(16, 32)
|
||||
builder:Prep(8, 32)
|
||||
builder:Pad(2)
|
||||
builder:Prep(2, 4)
|
||||
builder:Pad(1)
|
||||
|
||||
@@ -78,7 +78,7 @@ class Vec3 extends Struct
|
||||
*/
|
||||
public static function createVec3(FlatBufferBuilder $builder, $x, $y, $z, $test1, $test2, $test3_a, $test3_b)
|
||||
{
|
||||
$builder->prep(16, 32);
|
||||
$builder->prep(8, 32);
|
||||
$builder->pad(2);
|
||||
$builder->prep(2, 4);
|
||||
$builder->pad(1);
|
||||
|
||||
@@ -28,7 +28,7 @@ class Vec3(object):
|
||||
|
||||
|
||||
def CreateVec3(builder, x, y, z, test1, test2, test3_a, test3_b):
|
||||
builder.Prep(16, 32)
|
||||
builder.Prep(8, 32)
|
||||
builder.Pad(2)
|
||||
builder.Prep(2, 4)
|
||||
builder.Pad(1)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -27,7 +27,7 @@ table TestSimpleTableWithEnum (csharp_partial, private) {
|
||||
color: Color = Green;
|
||||
}
|
||||
|
||||
struct Vec3 (force_align: 16) {
|
||||
struct Vec3 (force_align: 8) {
|
||||
x:float;
|
||||
y:float;
|
||||
z:float;
|
||||
|
||||
@@ -545,7 +545,7 @@ inline bool operator==(const Test &lhs, const Test &rhs) {
|
||||
(lhs.b() == rhs.b());
|
||||
}
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(16) Vec3 FLATBUFFERS_FINAL_CLASS {
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Vec3 FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
float x_;
|
||||
float y_;
|
||||
|
||||
@@ -487,7 +487,7 @@ MyGame.Example.Vec3.prototype.test3 = function(obj) {
|
||||
* @returns {flatbuffers.Offset}
|
||||
*/
|
||||
MyGame.Example.Vec3.createVec3 = function(builder, x, y, z, test1, test2, test3_a, test3_b) {
|
||||
builder.prep(16, 32);
|
||||
builder.prep(8, 32);
|
||||
builder.pad(2);
|
||||
builder.prep(2, 4);
|
||||
builder.pad(1);
|
||||
|
||||
@@ -118,7 +118,7 @@ struct Vec3 : flatbuffers_handle
|
||||
MyGame_Example_Test{ buf_, pos_ + 26 }
|
||||
|
||||
def CreateVec3(b_:flatbuffers_builder, x:float, y:float, z:float, test1:float, test2:int, test3_a:int, test3_b:int):
|
||||
b_.Prep(16, 32)
|
||||
b_.Prep(8, 32)
|
||||
b_.Pad(2)
|
||||
b_.Prep(2, 4)
|
||||
b_.Pad(1)
|
||||
|
||||
@@ -500,8 +500,8 @@ impl Test {
|
||||
}
|
||||
}
|
||||
|
||||
// struct Vec3, aligned to 16
|
||||
#[repr(C, align(16))]
|
||||
// struct Vec3, aligned to 8
|
||||
#[repr(C, align(8))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub struct Vec3 {
|
||||
x_: f32,
|
||||
|
||||
@@ -453,7 +453,7 @@ test3(obj?:MyGame.Example.Test):MyGame.Example.Test|null {
|
||||
* @returns flatbuffers.Offset
|
||||
*/
|
||||
static createVec3(builder:flatbuffers.Builder, x: number, y: number, z: number, test1: number, test2: MyGame.Example.Color, test3_a: number, test3_b: number):flatbuffers.Offset {
|
||||
builder.prep(16, 32);
|
||||
builder.prep(8, 32);
|
||||
builder.pad(2);
|
||||
builder.prep(2, 4);
|
||||
builder.pad(1);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -90,7 +90,7 @@ def CheckReadBuffer(buf, offset, sizePrefix = False):
|
||||
if sizePrefix:
|
||||
size = util.GetSizePrefix(buf, offset)
|
||||
# taken from the size of monsterdata_python_wire.mon, minus 4
|
||||
asserter(size == 348)
|
||||
asserter(size == 340)
|
||||
buf, offset = util.RemoveSizePrefix(buf, offset)
|
||||
monster = MyGame.Example.Monster.Monster.GetRootAsMonster(buf, offset)
|
||||
|
||||
|
||||
@@ -656,8 +656,8 @@ mod generated_code_alignment_and_padding {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn struct_vec3_is_aligned_to_16() {
|
||||
assert_eq!(16, ::std::mem::align_of::<my_game::example::Vec3>());
|
||||
fn struct_vec3_is_aligned_to_8() {
|
||||
assert_eq!(8, ::std::mem::align_of::<my_game::example::Vec3>());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user