Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
728101e3
Commit
728101e3
authored
Jan 08, 2019
by
lhchavez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the intrinsics part of the change to its own PR
Less controversial changes together is better.
parent
321d19c1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
20 deletions
+10
-20
src/integer.h
+10
-20
No files found.
src/integer.h
View file @
728101e3
...
@@ -55,26 +55,16 @@ GIT_INLINE(bool) git__add_uint64_overflow(uint64_t *out, uint64_t one, uint64_t
...
@@ -55,26 +55,16 @@ GIT_INLINE(bool) git__add_uint64_overflow(uint64_t *out, uint64_t one, uint64_t
}
}
/* Use clang/gcc compiler intrinsics whenever possible */
/* Use clang/gcc compiler intrinsics whenever possible */
#if (__has_builtin(__builtin_add_overflow) || \
#if (SIZE_MAX == ULONG_MAX) && __has_builtin(__builtin_uaddl_overflow)
(defined(__GNUC__) && (__GNUC__ >= 5)))
# define git__add_sizet_overflow(out, one, two) \
__builtin_uaddl_overflow(one, two, out)
# if (ULONG_MAX == ULLONG_MAX) && defined(_WIN64)
# define git__multiply_sizet_overflow(out, one, two) \
# define git__add_sizet_overflow(out, one, two) \
__builtin_umull_overflow(one, two, out)
__builtin_uaddll_overflow(one, two, out)
#elif (SIZE_MAX == UINT_MAX) && __has_builtin(__builtin_uadd_overflow)
# define git__multiply_sizet_overflow(out, one, two) \
# define git__add_sizet_overflow(out, one, two) \
__builtin_umulll_overflow(one, two, out)
__builtin_uadd_overflow(one, two, out)
# elif (ULONG_MAX == ULLONG_MAX)
# define git__multiply_sizet_overflow(out, one, two) \
# define git__add_sizet_overflow(out, one, two) \
__builtin_umul_overflow(one, two, out)
__builtin_uaddl_overflow(one, two, out)
# define git__multiply_sizet_overflow(out, one, two) \
__builtin_umull_overflow(one, two, out)
# else
# define git__add_sizet_overflow(out, one, two) \
__builtin_add_overflow(one, two, out)
# define git__multiply_sizet_overflow(out, one, two) \
__builtin_mul_overflow(one, two, out)
# endif
#else
#else
/**
/**
...
...
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