Skip to content

Commit

Permalink
Reverted changes from last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
marcizhu committed Mar 2, 2019
1 parent 40864ca commit ab7d469
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
12 changes: 4 additions & 8 deletions Cereal/Cereal/src/Buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,14 @@ namespace Cereal {
template<>
bool writeBytes<float>(float data)
{
unsigned int x;
*(unsigned int*)&x = *(unsigned int*)&data;
unsigned int x = *(unsigned int*)&data;
return writeBytes<unsigned int>(x);
}

template<>
bool writeBytes<double>(double data)
{
unsigned long long x;
*(unsigned long long*)&x = *(unsigned long long*)&data;
unsigned long long x = *(unsigned long long*)&data;
return writeBytes<unsigned long long>(x);
}
#endif
Expand Down Expand Up @@ -328,16 +326,14 @@ namespace Cereal {
template<>
inline bool Buffer::writeBytes<float>(float data)
{
unsigned int x;
*(unsigned int*)&x = *(unsigned int*)&data;
unsigned int x = *(unsigned int*)&data;
return writeBytes<unsigned int>(x);
}

template<>
inline bool Buffer::writeBytes<double>(double data)
{
unsigned long long x;
*(unsigned long long*)&x = *(unsigned long long*)&data;
unsigned long long x = *(unsigned long long*)&data;
return writeBytes<unsigned long long>(x);
}
#endif
Expand Down
12 changes: 4 additions & 8 deletions Cereal/Cereal/src/Writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,14 @@ namespace Cereal {
template<>
static unsigned int writeBytes<float>(byte* dest, unsigned int pointer, float data)
{
unsigned int x;
*(unsigned int*)&x = *(unsigned int*)&data;
unsigned int x = *(unsigned int*)&data;
return writeBytes<unsigned int>(dest, pointer, x);
}

template<>
static unsigned int writeBytes<double>(byte* dest, unsigned int pointer, double data)
{
unsigned long long x;
*(unsigned long long*)&x = *(unsigned long long*)&data;
unsigned long long x = *(unsigned long long*)&data;
return writeBytes<unsigned long long>(dest, pointer, x);
}
#endif
Expand All @@ -93,16 +91,14 @@ namespace Cereal {
template<>
inline unsigned int Writer::writeBytes<float>(byte* dest, unsigned int pointer, float data)
{
unsigned int x;
*(unsigned int*)&x = *(unsigned int*)&data;
unsigned int x = *(unsigned int*)&data;
return writeBytes<unsigned int>(dest, pointer, x);
}

template<>
inline unsigned int Writer::writeBytes<double>(byte* dest, unsigned int pointer, double data)
{
unsigned long long x;
*(unsigned long long*)&x = *(unsigned long long*)&data;
unsigned long long x = *(unsigned long long*)&data;
return writeBytes<unsigned long long>(dest, pointer, x);
}
#endif
Expand Down

0 comments on commit ab7d469

Please sign in to comment.