Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
655c97b9
Commit
655c97b9
authored
8 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Added two more intrinsics for long long types.
parent
d4a1703d
No related branches found
No related tags found
1 merge request
!301
New time line
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/intrinsics.h
+34
-0
34 additions, 0 deletions
src/intrinsics.h
with
34 additions
and
0 deletions
src/intrinsics.h
+
34
−
0
View file @
655c97b9
...
...
@@ -66,6 +66,23 @@ __attribute__((always_inline)) INLINE static int intrinsics_clz(
#endif
}
/**
* @brief Returns the number of leading 0-bits in x, starting at the most
* significant bit position. If x is 0, the result is undefined.
*
* This is a wrapper for the GNU intrinsic with an implementation.
*/
__attribute__
((
always_inline
))
INLINE
static
int
intrinsics_clzll
(
unsigned
long
long
x
)
{
#ifdef __GNUC__
/* Use GCC intrinsics if possible */
return
__builtin_clzll
(
x
);
#else
#error "Missing definition of clz for long long on this platform."
#endif
}
/**
* @brief Returns the number of 1-bits in x.
*
...
...
@@ -88,4 +105,21 @@ __attribute__((always_inline)) INLINE static int intrinsics_popcount(
#endif
}
/**
* @brief Returns the number of 1-bits in x.
*
* This is a wrapper for the GNU intrinsic with an implementation (from
* Hacker's Delight) if the compiler intrinsics are not available.
*/
__attribute__
((
always_inline
))
INLINE
static
int
intrinsics_popcountll
(
unsigned
long
long
x
)
{
#ifdef __GNUC__
/* Use GCC intrinsics if possible */
return
__builtin_popcountll
(
x
);
#else
#error "Missing definition of popcount for long long on this platform."
#endif
}
#endif
/* SWIFT_INTRINSICS_H */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment