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

Error on big endian machine #449

Open
nnllyy opened this issue Mar 2, 2023 · 7 comments
Open

Error on big endian machine #449

nnllyy opened this issue Mar 2, 2023 · 7 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@nnllyy
Copy link

nnllyy commented Mar 2, 2023

The following structures cannot use memcpy

mqtt_msg.h

typedef struct {
uint8_t bit_0 : 1;
uint8_t bit_1 : 1;
uint8_t bit_2 : 1;
uint8_t bit_3 : 1;
uint8_t packet_type : 4;
} mqtt_common_hdr;

typedef struct {
uint8_t retain : 1;
uint8_t qos : 2;
uint8_t dup : 1;
uint8_t packet_type : 4;
} mqtt_pub_hdr;

@JaylinYu JaylinYu added the enhancement New feature or request label Mar 2, 2023
@JaylinYu JaylinYu added the bug Something isn't working label Mar 31, 2023
@JaylinYu JaylinYu assigned JaylinYu and xinyi-xs and unassigned alvin1221 May 17, 2023
@xinyi-xs
Copy link
Contributor

I'm sorry, but I'm having trouble understanding whether you're asking about copying data between a buffer and a struct, or between two structs. Could you please clarify which scenario you're referring to?

@nnllyy
Copy link
Author

nnllyy commented May 17, 2023 via email

@nnllyy
Copy link
Author

nnllyy commented May 17, 2023 via email

@xinyi-xs
Copy link
Contributor

@nnllyy thanks for your advice, I will try it.

@xinyi-xs
Copy link
Contributor

Hi @nnllyy, I wanted to thank you for your advice. I've implemented the struct with bit-field endian-independent, but I haven't tested it on a big endian machine yet. Would you be able to test it on your machine and provide some feedback?

@nnllyy
Copy link
Author

nnllyy commented May 22, 2023

Hi @nnllyy, I wanted to thank you for your advice. I've implemented the struct with bit-field endian-independent, but I haven't tested it on a big endian machine yet. Would you be able to test it on your machine and provide some feedback?

My machine is a router and requires cross compilation to run. You can push it and I will test it again

@JaylinYu
Copy link
Member

is that router an OpenWRT on MIPS ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants