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

bma180 two complement is int size dependent. #4

Open
miky2k opened this issue May 27, 2017 · 0 comments
Open

bma180 two complement is int size dependent. #4

miky2k opened this issue May 27, 2017 · 0 comments

Comments

@miky2k
Copy link

miky2k commented May 27, 2017

I try to compile your code for esp8266 that is a 32bit cpu and i notice that you assume 16bit int size,
better leave to compiler these work!

here a possible solution
if (x&0x2000){
x= x-0b11111111111111-1;
//x|=0xc000; // set full 2 complement for neg values
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant