Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bbguimaraes
books
Commits
6265dd82
Commit
6265dd82
authored
Jul 16, 2021
by
bbguimaraes
Browse files
hcwocl: use `uintptr_t` for pointer conversions
parent
026f9321
Changes
2
Hide whitespace changes
Inline
Side-by-side
hcwocl/Common/Math/Math.h
View file @
6265dd82
...
...
@@ -163,7 +163,8 @@ struct SortData
template
<
typename
T
>
T
*
addByteOffset
(
void
*
baseAddr
,
u32
offset
)
{
return
(
T
*
)(((
u32
)
baseAddr
)
+
offset
);
return
static_cast
<
T
*>
(
static_cast
<
void
*>
(
static_cast
<
char
*>
(
baseAddr
)
+
offset
));
}
...
...
hcwocl/Common/Math/float4.inl
View file @
6265dd82
/*
2011 Takahiro Harada
*/
//#define CHECK_ALIGNMENT(a) CLASSERT((u32(&(a)) & 0xf) == 0);
#define CHECK_ALIGNMENT(a) a;
#include <cstdint>
#define CHECK_ALIGNMENT(a) \
CLASSERT(!reinterpret_cast<std::uintptr_t>(&(a)) & 0xf)
__inline
float4 make_float4(float x, float y, float z, float w = 0.f)
...
...
@@ -81,7 +82,7 @@ float4 operator-(const float4& a)
__inline
float4 operator*(const float4& a, const float4& b)
{
CLASSERT((
u32
(&a) & 0xf) == 0);
CLASSERT((
reinterpret_cast<std::uintptr_t>
(&a) & 0xf) == 0);
float4 out;
out.s[0] = a.s[0]*b.s[0];
...
...
@@ -168,7 +169,7 @@ void operator/=(float4& a, const float4& b)
__inline
void operator/=(float4& a, float b)
{
CLASSERT((
u32
(&a) & 0xf) == 0);
CLASSERT((
reinterpret_cast<std::uintptr_t>
(&a) & 0xf) == 0);
a.s[0]/=b;
a.s[1]/=b;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment