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

Add support for long double #75

Merged
merged 9 commits into from Apr 4, 2016
Merged

Add support for long double #75

merged 9 commits into from Apr 4, 2016

Conversation

codemercenary
Copy link
Contributor

Need to ensure that all write serializers support this type.

Need to ensure that all write serializers support this type.
@codemercenary codemercenary added this to the v0.3.3 milestone Apr 2, 2016
@@ -138,10 +138,12 @@ namespace leap {

virtual void WriteFloat(float value) { WriteByteArray(&value, sizeof(float)); }
virtual void WriteFloat(double value) { WriteByteArray(&value, sizeof(double)); }
virtual void WriteFloat(long double value) { WriteByteArray(&value, sizeof(double)); }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should that be sizeof(long double)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For correctness, yes. I'm surprised that the unit test didn't catch this one. I'll add a test that does catch it, then fix this spot.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this wasn't getting caught because sizeof(double) == sizeof(long double) on my particular build, and also, the build server actually does catch this failure case correctly. Easy enough to fix.

@gittyupagain
Copy link
Contributor

In src/leapserial/serial_traits.h, control in the type() function in struct primitive_serial_traits<T...> can reach the end of the function without returning a value when T is long double.

@codemercenary
Copy link
Contributor Author

Actually there's a lot more to it than that--I have to add a new f80 serial atom type to handle this case. I'll push the change now, you tell me what you think.

@gittyupagain
Copy link
Contributor

Clang warns that you should add explicit braces to avoid a dangling else in serial_traits.h (line 80).

@codemercenary
Copy link
Contributor Author

Oh clang.

@gittyupagain
Copy link
Contributor

You are missing a case statement for serial_atom::f80 in leap::internal::protobuf::ToWireType.

@gittyupagain gittyupagain merged commit 3a2dc0e into master Apr 4, 2016
@gittyupagain gittyupagain deleted the feature-longdouble branch April 4, 2016 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants