Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CMake
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
André Pedro
CMake
Commits
7189d62c
Commit
7189d62c
authored
8 years ago
by
Brad King
Browse files
Options
Downloads
Patches
Plain Diff
librhash: Use __builtin_bswap{32,64} on Clang
parent
af7ebf8a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Utilities/cmlibrhash/librhash/byte_order.h
+8
-0
8 additions, 0 deletions
Utilities/cmlibrhash/librhash/byte_order.h
with
8 additions
and
0 deletions
Utilities/cmlibrhash/librhash/byte_order.h
+
8
−
0
View file @
7189d62c
...
...
@@ -85,6 +85,10 @@ void rhash_swap_copy_str_to_u64(void* to, int index, const void* from, size_t le
void
rhash_swap_copy_u64_to_str
(
void
*
to
,
const
void
*
from
,
size_t
length
);
void
rhash_u32_mem_swap
(
unsigned
*
p
,
int
length_in_u32
);
#ifndef __has_builtin
# define __has_builtin(x) 0
#endif
/* define bswap_32 */
#if defined(__GNUC__) && defined(CPU_IA32) && !defined(__i386__)
/* for intel x86 CPU */
...
...
@@ -95,6 +99,8 @@ static inline uint32_t bswap_32(uint32_t x) {
#elif defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 3)
/* for GCC >= 4.3 */
# define bswap_32(x) __builtin_bswap32(x)
#elif defined(__clang__) && __has_builtin(__builtin_bswap32)
# define bswap_32(x) __builtin_bswap32(x)
#elif (_MSC_VER > 1300) && (defined(CPU_IA32) || defined(CPU_X64))
/* MS VC */
# define bswap_32(x) _byteswap_ulong((unsigned long)x)
#elif !defined(__STRICT_ANSI__)
...
...
@@ -110,6 +116,8 @@ static inline uint32_t bswap_32(uint32_t x) {
#if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 3)
# define bswap_64(x) __builtin_bswap64(x)
#elif defined(__clang__) && __has_builtin(__builtin_bswap64)
# define bswap_64(x) __builtin_bswap64(x)
#elif (_MSC_VER > 1300) && (defined(CPU_IA32) || defined(CPU_X64))
/* MS VC */
# define bswap_64(x) _byteswap_uint64((__int64)x)
#elif !defined(__STRICT_ANSI__)
...
...
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