-
Notifications
You must be signed in to change notification settings - Fork 0
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
Solving the problem of excessive space usage by boolean arrays #1
Comments
Spread the array into bit field with a option to control it? (e.g. It seems impossible to use bit field, since there is no such thing like 'bit field array'. If we just spread the array, it will be difficult to accessed by index or in other form. // Struct: RovExdataLeakageData [6] {1 fields}
struct RovExdataLeakageData {
// [0, 6) NormalField: bool<48> leakage[6]
bool leakage_1 : 1;
bool leakage_2 : 1;
bool leakage_3 : 1;
...
bool leakage_48 : 1;
}; |
Or maybe we should combine all these forms struct RovlinkFrame {
...
uint8<6> payload;
...
}
struct RovExdataLeakageDataUint8Array[6] {
uint8<6> leakage [order="big"];
}
struct RovExdataLeakageDataBoolArray[6] {
bool<48> leakage [order="big"];
}
struct RovExdataLeakageDataBoolArrayUnfolded[6] {
bool<48> leakage [order="big", unfold = true];
}
struct RovExdataLeakageDataUint64[6] {
uint64 leakage[6];
} User should take
However, in this form, user still can not do random access by index, unless they use normal bool array. Or maybe we should provide a macro to assistant this? |
We have a structure like this
It contains 48 bool bit to indicate where each sensor detects leackage or not.
However, it will be translated as below
This structure will take up to 48 Byte space in memory, which is unacceptable for embedded device.
Could we figure out a solution to reduce the consumption of memory?
The text was updated successfully, but these errors were encountered: