Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
2960aa54
Commit
2960aa54
authored
Jul 16, 2017
by
Zulkarnine Mahmud
Committed by
GitHub
Jul 16, 2017
Browse files
Remove duplicate code
parent
a6b146df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
16 deletions
+6
-16
googletest/src/gtest.cc
googletest/src/gtest.cc
+6
-16
No files found.
googletest/src/gtest.cc
View file @
2960aa54
...
@@ -2894,27 +2894,17 @@ WORD GetColorAttribute(GTestColor color) {
...
@@ -2894,27 +2894,17 @@ WORD GetColorAttribute(GTestColor color) {
}
}
}
}
int
GetB
g
Offset
(
WORD
background
_mask
)
{
int
GetB
it
Offset
(
WORD
color
_mask
)
{
if
(
background
_mask
==
0
)
return
0
;
if
(
color
_mask
==
0
)
return
0
;
int
bitOffset
=
0
;
int
bitOffset
=
0
;
while
((
background
_mask
&
1
)
==
0
)
{
while
((
color
_mask
&
1
)
==
0
)
{
background
_mask
>>=
1
;
color
_mask
>>=
1
;
++
bitOffset
;
++
bitOffset
;
}
}
return
bitOffset
;
return
bitOffset
;
}
}
int
GetFgOffset
(
WORD
foreground_mask
)
{
if
(
foreground_mask
==
0
)
return
0
;
int
bitOffset
=
0
;
while
((
foreground_mask
&
1
)
==
0
)
{
foreground_mask
>>=
1
;
++
bitOffset
;
}
return
bitOffset
;
}
WORD
GetNewColor
(
GTestColor
color
,
WORD
old_color_attrs
)
{
WORD
GetNewColor
(
GTestColor
color
,
WORD
old_color_attrs
)
{
// Let's reuse the BG
// Let's reuse the BG
static
const
WORD
background_mask
=
BACKGROUND_BLUE
|
BACKGROUND_GREEN
|
BACKGROUND_RED
|
BACKGROUND_INTENSITY
;
static
const
WORD
background_mask
=
BACKGROUND_BLUE
|
BACKGROUND_GREEN
|
BACKGROUND_RED
|
BACKGROUND_INTENSITY
;
...
@@ -2922,8 +2912,8 @@ WORD GetNewColor(GTestColor color, WORD old_color_attrs) {
...
@@ -2922,8 +2912,8 @@ WORD GetNewColor(GTestColor color, WORD old_color_attrs) {
const
WORD
existing_bg
=
old_color_attrs
&
background_mask
;
const
WORD
existing_bg
=
old_color_attrs
&
background_mask
;
WORD
new_color
=
GetColorAttribute
(
color
)
|
existing_bg
|
FOREGROUND_INTENSITY
;
WORD
new_color
=
GetColorAttribute
(
color
)
|
existing_bg
|
FOREGROUND_INTENSITY
;
static
const
int
bg_bitOffset
=
GetB
g
Offset
(
background_mask
);
static
const
int
bg_bitOffset
=
GetB
it
Offset
(
background_mask
);
static
const
int
fg_bitOffset
=
Get
Fg
Offset
(
foreground_mask
);
static
const
int
fg_bitOffset
=
Get
Bit
Offset
(
foreground_mask
);
if
(((
new_color
&
background_mask
)
>>
bg_bitOffset
)
==
((
new_color
&
foreground_mask
)
>>
fg_bitOffset
))
{
if
(((
new_color
&
background_mask
)
>>
bg_bitOffset
)
==
((
new_color
&
foreground_mask
)
>>
fg_bitOffset
))
{
new_color
^=
FOREGROUND_INTENSITY
;
//invert intensity
new_color
^=
FOREGROUND_INTENSITY
;
//invert intensity
...
...
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