mafintosh / mafintosh/shared-structs
option.alignment not works
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 117
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
```
const sharedStructs = require('shared-structs'
,{ // option
alignment: {
foo: 1 // set the alignment of struct foo = 1, as in the description of options
}
});
const structs = sharedStructs('
#pragma pack(1) // request alignment=1, in source header file
struct foo {
uint8_t an_unsigned_num;
int32_t a_signed_num;
};
');
const test = structs.foo()
//console.log(test)
console.log(test.rawBuffer.length)
// error length != 5
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the supplied JavaScript example with the alignment option and the packed C-style struct definition. Trace how the alignment option and #pragma pack(1) affect the generated foo layout, then verify that test.rawBuffer.length is 5 for the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100