Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
30
Issues
30
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Software for White Rabbit PTP Core
Commits
f6c6398d
Commit
f6c6398d
authored
Nov 21, 2012
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pp_printf: bugfix: support negatives in xint flavour
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
89d6347d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
vsprintf-xint.c
pp_printf/vsprintf-xint.c
+12
-2
No files found.
pp_printf/vsprintf-xint.c
View file @
f6c6398d
...
...
@@ -11,17 +11,27 @@ static const char hex[] = "0123456789abcdef";
static
int
number
(
char
*
out
,
int
value
,
int
base
,
int
lead
,
int
wid
)
{
char
tmp
[
16
];
int
i
=
16
,
ret
;
int
i
=
16
,
ret
,
negative
=
0
;
/* No error checking at all: it is as ugly as possible */
if
(
value
<
0
)
{
negative
=
1
;
value
=
-
value
;
}
while
(
value
&&
i
)
{
tmp
[
--
i
]
=
hex
[
value
%
base
];
value
/=
base
;
}
if
(
i
==
16
)
tmp
[
--
i
]
=
'0'
;
while
(
i
>
16
-
wid
)
if
(
negative
&&
lead
==
' '
)
{
tmp
[
--
i
]
=
'-'
;
negative
=
0
;
}
while
(
i
>
16
-
wid
-
negative
)
tmp
[
--
i
]
=
lead
;
if
(
negative
)
tmp
[
--
i
]
=
'-'
;
ret
=
16
-
i
;
while
(
i
<
16
)
*
(
out
++
)
=
tmp
[
i
++
];
...
...
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