Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to use structs without tail-padding #65

Closed
inkeliz opened this issue Aug 23, 2022 · 0 comments · Fixed by #76
Closed

Option to use structs without tail-padding #65

inkeliz opened this issue Aug 23, 2022 · 0 comments · Fixed by #76

Comments

@inkeliz
Copy link
Owner

inkeliz commented Aug 23, 2022

Currently, Karmem is one mixed of packed and unpacked. It doesn't have padding between fields, but have one "tail-padding", one padding at the end of the struct, that enforces the content to have alignment of 8 bytes.

@inkeliz inkeliz changed the title Support for structs without tail-padding Option to use structs without tail-padding Aug 23, 2022
inkeliz added a commit that referenced this issue Aug 26, 2022
Now, it's possible (and recommended) to use `@packed()` to produce
smaller encoded data. Additionally, `table` will use `@packed()` by
default, and that is backward-compatible.

That change also removes the `size-each` value from slice-headers,
which saves 4-bytes per each dynamic array.

This tag can be use in the project header, enabling it on all
`inline` struct declared in the file:
```
karmem name @PACKED();
```

This tag can be used to enable/disable `@packed()` for each
`inline`:

```
struct Foo inline @PACKED(true) { ... }
```

If the document is using `@packed(true), it's possible to opt-out,
using `@packed(false)` for specific struct:

```
struct Foo inline @PACKED(false) { ... }
```

There's no reason to use `@packed(false)`, except from compatibility
reasons, for projects releases before this patch.

Closes #71, #65
Fixes #32

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
inkeliz added a commit that referenced this issue Aug 26, 2022
Now, it's possible (and recommended) to use `@packed()` to produce
smaller encoded data. Additionally, `table` will use `@packed()` by
default, and that is backward-compatible.

That change also removes the `size-each` value from slice-headers,
which saves 4-bytes per each dynamic array.

This tag can be use in the project header, enabling it on all
`inline` struct declared in the file:
```
karmem name @PACKED();
```

This tag can be used to enable/disable `@packed()` for each
`inline`:

```
struct Foo inline @PACKED(true) { ... }
```

If the document is using `@packed(true)`, it's possible to opt-out,
using `@packed(false)` for specific struct:

```
struct Foo inline @PACKED(false) { ... }
```

There's no reason to use `@packed(false)`, except from compatibility
reasons, for projects releases before this patch.

Closes #71, #65
Fixes #32

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
inkeliz added a commit that referenced this issue Aug 26, 2022
Now, it's possible (and recommended) to use `@packed()` to produce
smaller encoded data. Additionally, `table` will use `@packed()` by
default, and that is backward-compatible.

That change also removes the `size-each` value from slice-headers,
which saves 4-bytes per each dynamic array.

This tag can be use in the project header, enabling it on all
`inline` struct declared in the file:
```
karmem name @PACKED();
```

This tag can be used to enable/disable `@packed()` for each
`inline`:

```
struct Foo inline @PACKED(true) { ... }
```

If the document is using `@packed(true)`, it's possible to opt-out,
using `@packed(false)` for specific struct:

```
struct Foo inline @PACKED(false) { ... }
```

There's no reason to use `@packed(false)`, except from compatibility
reasons, for projects releases before this patch.

Closes #71
Closes #65
Fixes #32

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
inkeliz added a commit that referenced this issue Aug 26, 2022
Now, it's possible (and recommended) to use `@packed()` to produce
smaller encoded data. Additionally, `table` will use `@packed()` by
default, and that is backward-compatible.

That change also removes the `size-each` value from slice-headers,
which saves 4-bytes per each dynamic array.

This tag can be use in the project header, enabling it on all
`inline` struct declared in the file:
```
karmem name @PACKED();
```

This tag can be used to enable/disable `@packed()` for each
`inline`:

```
struct Foo inline @PACKED(true) { ... }
```

If the document is using `@packed(true)`, it's possible to opt-out,
using `@packed(false)` for specific struct:

```
struct Foo inline @PACKED(false) { ... }
```

There's no reason to use `@packed(false)`, except from compatibility
reasons, for projects releases before this patch.

Closes #71
Closes #65
Fixes #32

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
inkeliz added a commit that referenced this issue Aug 26, 2022
Now, it's possible (and recommended) to use `@packed()` to produce
smaller encoded data. Additionally, `table` will use `@packed()` by
default, and that is backward-compatible.

That change also removes the `size-each` value from slice-headers,
which saves 4-bytes per each dynamic array.

This tag can be use in the project header, enabling it on all
`inline` struct declared in the file:
```
karmem name @PACKED();
```

This tag can be used to enable/disable `@packed()` for each
`inline`:

```
struct Foo inline @PACKED(true) { ... }
```

If the document is using `@packed(true)`, it's possible to opt-out,
using `@packed(false)` for specific struct:

```
struct Foo inline @PACKED(false) { ... }
```

There's no reason to use `@packed(false)`, except from compatibility
reasons, for projects releases before this patch.

Closes #71
Closes #65
Fixes #32

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
inkeliz added a commit that referenced this issue Aug 28, 2022
Now, it's possible (and recommended) to use `@packed()` to produce
smaller encoded data. Additionally, `table` will use `@packed()` by
default, and that is backward-compatible.

That change also removes the `size-each` value from slice-headers,
which saves 4-bytes per each dynamic array.

This tag can be use in the project header, enabling it on all
`inline` struct declared in the file:
```
karmem name @PACKED();
```

This tag can be used to enable/disable `@packed()` for each
`inline`:

```
struct Foo inline @PACKED(true) { ... }
```

If the document is using `@packed(true)`, it's possible to opt-out,
using `@packed(false)` for specific struct:

```
struct Foo inline @PACKED(false) { ... }
```

There's no reason to use `@packed(false)`, except from compatibility
reasons, for projects releases before this patch.

Closes #71
Closes #65
Fixes #32

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Stage 3: Generator A
Development

Successfully merging a pull request may close this issue.

1 participant