Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
core
tarantool
Commits
14d25f4b
Commit
14d25f4b
authored
10 years ago
by
Roman Tsisyk
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
8620f7c6
68f9be81
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
src/lib/bit/int96.h
+4
-11
4 additions, 11 deletions
src/lib/bit/int96.h
with
4 additions
and
11 deletions
src/lib/bit/int96.h
+
4
−
11
View file @
14d25f4b
...
...
@@ -32,9 +32,6 @@
#include
<inttypes.h>
#include
<assert.h>
#ifdef __cplusplus
extern
"C"
{
#endif
/**
* 96-bit signed integer.
* 1)Negative integer is stored as 96-bit two's complement
...
...
@@ -42,13 +39,13 @@ extern "C" {
* Actually (1) == (2), as the wave-particle duality.
* Designed for storing integers in range [INT64_MIN, UINT64_MAX],
* and detecting overflow (out of range [INT64_MIN, UINT64_MAX])
* after operations (addition, sub
s
tr
u
ction) on them.
* after operations (addition, subtr
a
ction) on them.
* The base fact is when two uint64_t or int64_t values
* are converted to int96, and then added or sub
s
tr
u
cted, the
* are converted to int96, and then added or subtr
a
cted, the
* int96 arithmetics cannot overflow. Actually you need at least
* billions of adding UINT64_MAX or INT64_MIN to make it overflow.
* Addition is implemented directly;
* For sub
s
traction use addition of inverted number.
* For subtraction use addition of inverted number.
*/
/**
...
...
@@ -154,7 +151,7 @@ int96_is_neg_int64(const struct int96_num *num)
/**
* Get number as negative int64_t,
* the n
y
mber is expected to be valid range (assert)
* the n
u
mber is expected to be valid range (assert)
*/
static
inline
int64_t
int96_extract_neg_int64
(
const
struct
int96_num
*
num
)
...
...
@@ -163,8 +160,4 @@ int96_extract_neg_int64(const struct int96_num *num)
return
(
int64_t
)
int96_get_low64bit
(
num
);
}
#ifdef __cplusplus
}
/* extern "C" { */
#endif
#endif
/* #ifndef TARANTOOL_LIB_BIT_INT96_H_INCLUDED */
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