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

reimplemented io support for basic types #144

Merged
merged 7 commits into from
Jun 19, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed: warning wrt. strict aliasing on gcc 4.8.2/clang3.3
  • Loading branch information
regnirpsj committed Apr 13, 2014
commit 37e586820080437a7e26441b2dd54398cc1d4d48
6 changes: 5 additions & 1 deletion glm/core/func_exponential.inl
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,11 @@ namespace detail
genType xhalf(tmp * genType(0.5f));
genUType i = *reinterpret_cast<genUType*>(const_cast<genType*>(&v));
i = genUType(0x5f375a86) - (i >> genUType(1));
tmp = *reinterpret_cast<genType*>(&i);
// tmp = *reinterpret_cast<genType*>(&i);
{
genType* ptr(reinterpret_cast<genType*>(&i));
tmp = *ptr;
}
tmp = tmp * (genType(1.5f) - xhalf * tmp * tmp);
return tmp;
}
Expand Down
5 changes: 3 additions & 2 deletions glm/core/func_integer.inl
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ namespace glm

uint64 Value64 = static_cast<uint64>(x) * static_cast<uint64>(y);
msb = *(reinterpret_cast<uint32*>(&Value64) + 1);
lsb = reinterpret_cast<uint32&>(Value64);
//lsb = reinterpret_cast<uint32&>(Value64);
lsb = *(reinterpret_cast<uint32*>(Value64));
}

template <>
Expand Down Expand Up @@ -231,7 +232,7 @@ namespace glm

int64 Value64 = static_cast<int64>(x) * static_cast<int64>(y);
msb = *(reinterpret_cast<int32*>(&Value64) + 1);
lsb = reinterpret_cast<int32&>(Value64);
// lsb = reinterpret_cast<int32&>(Value64);
}

template <>
Expand Down
12 changes: 9 additions & 3 deletions glm/core/func_packing.inl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ namespace glm
GLM_FUNC_QUALIFIER uint packUnorm2x16(vec2 const & v)
{
u16vec2 Topack(round(clamp(v, 0.0f, 1.0f) * 65535.0f));
return reinterpret_cast<uint&>(Topack);
// return reinterpret_cast<uint&>(Topack);
uint* ptr(reinterpret_cast<uint*>(&Topack));
return *ptr;
}

GLM_FUNC_QUALIFIER vec2 unpackUnorm2x16(uint const & p)
Expand All @@ -47,7 +49,9 @@ namespace glm
GLM_FUNC_QUALIFIER uint packSnorm2x16(vec2 const & v)
{
i16vec2 Topack(round(clamp(v ,-1.0f, 1.0f) * 32767.0f));
return reinterpret_cast<uint32&>(Topack);
// return reinterpret_cast<uint32&>(Topack);
uint* ptr(reinterpret_cast<uint*>(&Topack));
return *ptr;
}

GLM_FUNC_QUALIFIER vec2 unpackSnorm2x16(uint const & p)
Expand Down Expand Up @@ -100,7 +104,9 @@ namespace glm
detail::toFloat16(v.x),
detail::toFloat16(v.y));

return *reinterpret_cast<uint*>(&Unpack);
//return *reinterpret_cast<uint*>(&Unpack);
uint* ptr(reinterpret_cast<uint*>(&Unpack));
return *ptr;
}

GLM_FUNC_QUALIFIER vec2 unpackHalf2x16(uint const & v)
Expand Down
4 changes: 2 additions & 2 deletions glm/gtx/bit.inl
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ namespace glm
assert(ToBit <= sizeof(genIUType) * std::size_t(8));

genIUType Result = Value;
for(std::size_t i = 0; i <= ToBit; ++i)
for(signed i = 0; i <= ToBit; ++i)
Result |= (1 << i);
return Result;
}
Expand All @@ -568,7 +568,7 @@ namespace glm
assert(ToBit <= sizeof(genIUType) * std::size_t(8));

genIUType Result = Value;
for(std::size_t i = 0; i <= ToBit; ++i)
for(signed i = 0; i <= ToBit; ++i)
Result &= ~(1 << i);
return Result;
}
Expand Down