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
tsoc
openmm
Commits
c77af6e9
Commit
c77af6e9
authored
Jun 28, 2012
by
Peter Eastman
Browse files
Use the __popc intrinsic for counting bits
parent
f0c2e89c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
5 deletions
+1
-5
platforms/cuda2/src/kernels/findInteractingBlocks.cu
platforms/cuda2/src/kernels/findInteractingBlocks.cu
+1
-5
No files found.
platforms/cuda2/src/kernels/findInteractingBlocks.cu
View file @
c77af6e9
...
@@ -228,11 +228,7 @@ extern "C" __global__ void findInteractionsWithinBlocks(real4 periodicBoxSize, r
...
@@ -228,11 +228,7 @@ extern "C" __global__ void findInteractionsWithinBlocks(real4 periodicBoxSize, r
// Count how many flags are set, and based on that decide whether to compute all interactions
// Count how many flags are set, and based on that decide whether to compute all interactions
// or only a fraction of them.
// or only a fraction of them.
unsigned
int
bits
=
(
allFlags
&
0x55555555
)
+
((
allFlags
>>
1
)
&
0x55555555
);
int
bits
=
__popc
(
allFlags
);
bits
=
(
bits
&
0x33333333
)
+
((
bits
>>
2
)
&
0x33333333
);
bits
=
(
bits
&
0x0F0F0F0F
)
+
((
bits
>>
4
)
&
0x0F0F0F0F
);
bits
=
(
bits
&
0x00FF00FF
)
+
((
bits
>>
8
)
&
0x00FF00FF
);
bits
=
(
bits
&
0x0000FFFF
)
+
((
bits
>>
16
)
&
0x0000FFFF
);
interactionFlags
[
pos
]
=
(
bits
>
12
?
0xFFFFFFFF
:
allFlags
);
interactionFlags
[
pos
]
=
(
bits
>
12
?
0xFFFFFFFF
:
allFlags
);
}
}
lasty
=
y
;
lasty
=
y
;
...
...
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