Closed matwey closed 8 years ago
I suppose
enum eterm_type {
should be
class enum eterm_type: std::unit64_t {
or something like that.
Never tested this project on 32bit platforms as this wasn't something I ever needed. You can try to patch it if it works. In your suggestion above it should be "enum eterm_type: uint64_t"
, so that it doesn't enforce type prefixing, but eterm_type must be 4 bytes long (or else var type won't work).
Is it really required that sizeof(eterm)==16
? Maybe you meant sizeof(eterm)<=16
?
https://github.com/saleyn/eixx/blob/master/include/eixx/marshal/var.hpp#L55 here you suppose that sizeof(eterm_type)<=4
, because there is assert that sizeof(var)==8
The eterm contains a union of all supported types including double and pointer, and the eterm_type indicating what type is stored. So the size of eterm is max(sizeof(double),sizeof(void*)) + aligned_size_of(eterm_type))
, which is 8+4(alignment)+4
.
Apparently the size of eterm_type is 4, and the size of var is 4 + sizeof(atom), which is 8.
Sure, but aligning is platform dependent. I have not yet checked on ARMv7, but on i586 sizeof(eterm) is 12.
At armv7hl sizeof(eterm)==16
The main design assumption was that eterm's storage can hold primitive types and reference types without sacrificing performance. I believe it should work on 32bit as well as 64bit architectures, in cases when sizeof(eterm) == 12, and 16, though as previously indicated was only concerned with a 64bit architecture. So I welcome the patches as long as they don't modify the 64bit performance/behavior.
Please, check new version of PR #18. Would you fine with:
BOOST_STATIC_ASSERT(sizeof(eterm) == (EIXX_ALIGNOF_UINT64_T > sizeof(int) ? EIXX_ALIGNOF_UINT64_T : sizeof(int)) + sizeof(uint64_t));
?
However, you already check in eterm that your union is 16-bytes long, so the rest is determined by compiler/architecture and depends on the size of enum and alignment rules. I would think that checking sizeof(eterm)
is redundant.
yes, that's fine.
Hello,
I am trying to compile eixx and see the following:
I use gcc 4.8.3, and boost 1.58, my system arch is x86 (32-bit).