Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
integer/test/integer_mask_test.cpp at develop · boostorg/integer · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Uh oh!
There was an error while loading.
Please reload this page
.
boostorg
/
integer
Public
Notifications
You must be signed in to change notification settings
Fork
58
Star
20
Code
Issues
1
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Files
Expand file tree
develop
Breadcrumbs
integer
/
test
/
integer_mask_test.cpp
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
203 lines (185 loc) · 6.42 KB
develop
Breadcrumbs
integer
/
test
/
integer_mask_test.cpp
Copy path
Top
File metadata and controls
Code
Blame
203 lines (185 loc) · 6.42 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
//
boost integer_mask.hpp test program -------------------------------------//
//
(C) Copyright Daryle Walker 2001.
//
Distributed under the Boost Software License, Version 1.0. (See
//
accompanying file LICENSE_1_0.txt or copy at
//
https://www.boost.org/LICENSE_1_0.txt)
//
See https://www.boost.org for most recent version including documentation.
//
Revision History
//
23 Sep 2001 Initial version (Daryle Walker)
#
include
<
boost/core/lightweight_test.hpp
>
#
include
<
boost/cstdlib.hpp
>
//
for boost::exit_success
#
include
<
boost/integer/integer_mask.hpp
>
//
for boost::high_bit_mask_t, etc.
#
include
<
iostream
>
//
for std::cout (std::endl indirectly)
#
ifdef
BOOST_MSVC
#
pragma
warning(disable:4127)
//
conditional expression is constant
#
endif
#
if
defined(BOOST_HAS_LONG_LONG)
#
define
MASK_TYPE
::boost::ulong_long_type
#
elif
defined(BOOST_HAS_MS_INT64)
#
define
MASK_TYPE
unsigned
__int64
#
else
#
define
MASK_TYPE
unsigned
long
#
endif
#
define
ONE
(
static_cast
<
MASK_TYPE
>(
1
))
#
define
PRIVATE_HIGH_BIT_SLOW_TEST
(
v
)
BOOST_TEST
( ::boost::
high_bit_mask_t
< \
(v) >::high_bit == (
ONE
<< (v)) );
#
define
PRIVATE_HIGH_BIT_FAST_TEST
(
v
)
BOOST_TEST
( ::boost::
high_bit_mask_t
< \
(v) >::high_bit_fast == (
ONE
<< (v)) );
#
define
PRIVATE_HIGH_BIT_TEST
(
v
)
do
{
PRIVATE_HIGH_BIT_SLOW_TEST
(v); \
PRIVATE_HIGH_BIT_FAST_TEST
(v); }
while
(
false
)
#
define
PRIVATE_LOW_BITS_SLOW_TEST
(
v
) \
do
{ \
MASK_TYPE
mask =
0
;\
if
(v >
0
)\
{ mask = ((
ONE
<< (v-
1
)) -
1
); mask <<=
1
; mask |=
1
; }\
BOOST_TEST
( ::boost::
low_bits_mask_t
< (v) >::sig_bits == mask); \
}
while
(
false
);
#
define
PRIVATE_LOW_BITS_FAST_TEST
(
v
) \
do
{ \
MASK_TYPE
mask =
0
;\
if
(v >
0
)\
{ mask = ((
ONE
<< (v-
1
)) -
1
); mask <<=
1
; mask |=
1
; }\
BOOST_TEST
( ::boost::
low_bits_mask_t
< (v) >::sig_bits_fast == mask);\
}
while
(
false
);
#
define
PRIVATE_LOW_BITS_TEST
(
v
)
do
{
PRIVATE_LOW_BITS_SLOW_TEST
(v); \
PRIVATE_LOW_BITS_FAST_TEST
(v); }
while
(
false
)
int
main
(
int
,
char
*[] )
{
using
std::cout;
using
std::endl;
cout <<
"
Doing high_bit_mask_t tests.
"
<< endl;
#
if
defined(BOOST_HAS_LONG_LONG) || defined(BOOST_HAS_MS_INT64)
PRIVATE_HIGH_BIT_TEST
(
63
);
PRIVATE_HIGH_BIT_TEST
(
62
);
PRIVATE_HIGH_BIT_TEST
(
61
);
PRIVATE_HIGH_BIT_TEST
(
60
);
PRIVATE_HIGH_BIT_TEST
(
59
);
PRIVATE_HIGH_BIT_TEST
(
58
);
PRIVATE_HIGH_BIT_TEST
(
57
);
PRIVATE_HIGH_BIT_TEST
(
56
);
PRIVATE_HIGH_BIT_TEST
(
55
);
PRIVATE_HIGH_BIT_TEST
(
54
);
PRIVATE_HIGH_BIT_TEST
(
53
);
PRIVATE_HIGH_BIT_TEST
(
52
);
PRIVATE_HIGH_BIT_TEST
(
51
);
PRIVATE_HIGH_BIT_TEST
(
50
);
PRIVATE_HIGH_BIT_TEST
(
49
);
PRIVATE_HIGH_BIT_TEST
(
48
);
PRIVATE_HIGH_BIT_TEST
(
47
);
PRIVATE_HIGH_BIT_TEST
(
46
);
PRIVATE_HIGH_BIT_TEST
(
45
);
PRIVATE_HIGH_BIT_TEST
(
44
);
PRIVATE_HIGH_BIT_TEST
(
43
);
PRIVATE_HIGH_BIT_TEST
(
42
);
PRIVATE_HIGH_BIT_TEST
(
41
);
PRIVATE_HIGH_BIT_TEST
(
40
);
PRIVATE_HIGH_BIT_TEST
(
39
);
PRIVATE_HIGH_BIT_TEST
(
38
);
PRIVATE_HIGH_BIT_TEST
(
37
);
PRIVATE_HIGH_BIT_TEST
(
36
);
PRIVATE_HIGH_BIT_TEST
(
35
);
PRIVATE_HIGH_BIT_TEST
(
34
);
PRIVATE_HIGH_BIT_TEST
(
33
);
PRIVATE_HIGH_BIT_TEST
(
32
);
#
endif
PRIVATE_HIGH_BIT_TEST
(
31
);
PRIVATE_HIGH_BIT_TEST
(
30
);
PRIVATE_HIGH_BIT_TEST
(
29
);
PRIVATE_HIGH_BIT_TEST
(
28
);
PRIVATE_HIGH_BIT_TEST
(
27
);
PRIVATE_HIGH_BIT_TEST
(
26
);
PRIVATE_HIGH_BIT_TEST
(
25
);
PRIVATE_HIGH_BIT_TEST
(
24
);
PRIVATE_HIGH_BIT_TEST
(
23
);
PRIVATE_HIGH_BIT_TEST
(
22
);
PRIVATE_HIGH_BIT_TEST
(
21
);
PRIVATE_HIGH_BIT_TEST
(
20
);
PRIVATE_HIGH_BIT_TEST
(
19
);
PRIVATE_HIGH_BIT_TEST
(
18
);
PRIVATE_HIGH_BIT_TEST
(
17
);
PRIVATE_HIGH_BIT_TEST
(
16
);
PRIVATE_HIGH_BIT_TEST
(
15
);
PRIVATE_HIGH_BIT_TEST
(
14
);
PRIVATE_HIGH_BIT_TEST
(
13
);
PRIVATE_HIGH_BIT_TEST
(
12
);
PRIVATE_HIGH_BIT_TEST
(
11
);
PRIVATE_HIGH_BIT_TEST
(
10
);
PRIVATE_HIGH_BIT_TEST
(
9
);
PRIVATE_HIGH_BIT_TEST
(
8
);
PRIVATE_HIGH_BIT_TEST
(
7
);
PRIVATE_HIGH_BIT_TEST
(
6
);
PRIVATE_HIGH_BIT_TEST
(
5
);
PRIVATE_HIGH_BIT_TEST
(
4
);
PRIVATE_HIGH_BIT_TEST
(
3
);
PRIVATE_HIGH_BIT_TEST
(
2
);
PRIVATE_HIGH_BIT_TEST
(
1
);
PRIVATE_HIGH_BIT_TEST
(
0
);
cout <<
"
Doing low_bits_mask_t tests.
"
<< endl;
#
if
defined(BOOST_HAS_LONG_LONG) || defined(BOOST_HAS_MS_INT64)
PRIVATE_LOW_BITS_TEST
(
64
);
PRIVATE_LOW_BITS_TEST
(
63
);
PRIVATE_LOW_BITS_TEST
(
62
);
PRIVATE_LOW_BITS_TEST
(
61
);
PRIVATE_LOW_BITS_TEST
(
60
);
PRIVATE_LOW_BITS_TEST
(
59
);
PRIVATE_LOW_BITS_TEST
(
58
);
PRIVATE_LOW_BITS_TEST
(
57
);
PRIVATE_LOW_BITS_TEST
(
56
);
PRIVATE_LOW_BITS_TEST
(
55
);
PRIVATE_LOW_BITS_TEST
(
54
);
PRIVATE_LOW_BITS_TEST
(
53
);
PRIVATE_LOW_BITS_TEST
(
52
);
PRIVATE_LOW_BITS_TEST
(
51
);
PRIVATE_LOW_BITS_TEST
(
50
);
PRIVATE_LOW_BITS_TEST
(
49
);
PRIVATE_LOW_BITS_TEST
(
48
);
PRIVATE_LOW_BITS_TEST
(
47
);
PRIVATE_LOW_BITS_TEST
(
46
);
PRIVATE_LOW_BITS_TEST
(
45
);
PRIVATE_LOW_BITS_TEST
(
44
);
PRIVATE_LOW_BITS_TEST
(
43
);
PRIVATE_LOW_BITS_TEST
(
42
);
PRIVATE_LOW_BITS_TEST
(
41
);
PRIVATE_LOW_BITS_TEST
(
40
);
PRIVATE_LOW_BITS_TEST
(
39
);
PRIVATE_LOW_BITS_TEST
(
38
);
PRIVATE_LOW_BITS_TEST
(
37
);
PRIVATE_LOW_BITS_TEST
(
36
);
PRIVATE_LOW_BITS_TEST
(
35
);
PRIVATE_LOW_BITS_TEST
(
34
);
PRIVATE_LOW_BITS_TEST
(
33
);
#
endif
PRIVATE_LOW_BITS_TEST
(
32
);
PRIVATE_LOW_BITS_TEST
(
31
);
PRIVATE_LOW_BITS_TEST
(
30
);
PRIVATE_LOW_BITS_TEST
(
29
);
PRIVATE_LOW_BITS_TEST
(
28
);
PRIVATE_LOW_BITS_TEST
(
27
);
PRIVATE_LOW_BITS_TEST
(
26
);
PRIVATE_LOW_BITS_TEST
(
25
);
PRIVATE_LOW_BITS_TEST
(
24
);
PRIVATE_LOW_BITS_TEST
(
23
);
PRIVATE_LOW_BITS_TEST
(
22
);
PRIVATE_LOW_BITS_TEST
(
21
);
PRIVATE_LOW_BITS_TEST
(
20
);
PRIVATE_LOW_BITS_TEST
(
19
);
PRIVATE_LOW_BITS_TEST
(
18
);
PRIVATE_LOW_BITS_TEST
(
17
);
PRIVATE_LOW_BITS_TEST
(
16
);
PRIVATE_LOW_BITS_TEST
(
15
);
PRIVATE_LOW_BITS_TEST
(
14
);
PRIVATE_LOW_BITS_TEST
(
13
);
PRIVATE_LOW_BITS_TEST
(
12
);
PRIVATE_LOW_BITS_TEST
(
11
);
PRIVATE_LOW_BITS_TEST
(
10
);
PRIVATE_LOW_BITS_TEST
(
9
);
PRIVATE_LOW_BITS_TEST
(
8
);
PRIVATE_LOW_BITS_TEST
(
7
);
PRIVATE_LOW_BITS_TEST
(
6
);
PRIVATE_LOW_BITS_TEST
(
5
);
PRIVATE_LOW_BITS_TEST
(
4
);
PRIVATE_LOW_BITS_TEST
(
3
);
PRIVATE_LOW_BITS_TEST
(
2
);
PRIVATE_LOW_BITS_TEST
(
1
);
return
boost::report_errors
();
}
You can’t perform that action at this time.