Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
c8e7984f
Commit
c8e7984f
authored
Aug 11, 2016
by
Matthieu Schaller
Browse files
No branch-free kernel
parent
63813f76
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/kernel_hydro.h
View file @
c8e7984f
...
...
@@ -250,15 +250,15 @@ __attribute__((always_inline)) INLINE static void kernel_deval(
/* Go to the range [0,1[ from [0,H[ */
const
float
x
=
u
*
kernel_gamma_inv
;
#if kernel_ivals == 1
/* Only one branch in this case */
const
float
*
const
coeffs
=
&
kernel_coeffs
[
0
];
#else
//
#if kernel_ivals == 1
//
/* Only one branch in this case */
//
const float *const coeffs = &kernel_coeffs[0];
//
#else
/* Pick the correct branch of the kernel */
const
int
temp
=
(
int
)(
x
*
kernel_ivals_f
);
const
int
ind
=
temp
>
kernel_ivals
?
kernel_ivals
:
temp
;
const
float
*
const
coeffs
=
&
kernel_coeffs
[
ind
*
(
kernel_degree
+
1
)];
#endif
//
#endif
/* First two terms of the polynomial ... */
float
w
=
coeffs
[
0
]
*
x
+
coeffs
[
1
];
...
...
@@ -288,15 +288,15 @@ __attribute__((always_inline)) INLINE static void kernel_eval(
/* Go to the range [0,1[ from [0,H[ */
const
float
x
=
u
*
kernel_gamma_inv
;
#if kernel_ivals == 1
/* Only one branch in this case */
const
float
*
const
coeffs
=
&
kernel_coeffs
[
0
];
#else
//
#if kernel_ivals == 1
//
/* Only one branch in this case */
//
const float *const coeffs = &kernel_coeffs[0];
//
#else
/* Pick the correct branch of the kernel */
const
int
temp
=
(
int
)(
x
*
kernel_ivals_f
);
const
int
ind
=
temp
>
kernel_ivals
?
kernel_ivals
:
temp
;
const
float
*
const
coeffs
=
&
kernel_coeffs
[
ind
*
(
kernel_degree
+
1
)];
#endif
//
#endif
/* First two terms of the polynomial ... */
float
w
=
coeffs
[
0
]
*
x
+
coeffs
[
1
];
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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