mirror of
https://github.com/YosysHQ/yosys
synced 2025-07-24 13:18:56 +00:00
fmt,cxxrtl: add support for NUMERIC
justification.
Before this commit, the existing alignments were `LEFT` and `RIGHT`, which added the `padding` character to the right and left just before finishing formatting. However, if `padding == '0'` and the alignment is to the right, then the padding character (digit zero) was added after the sign, if one is present. After this commit, the special case for `padding == '0'` is removed, and the new justification `NUMERIC` adds the padding character like the justification `RIGHT`, except after the sign, if one is present. (Space, for the `SPACE_MINUS` sign mode, counts as the sign.)
This commit is contained in:
parent
6d6b138607
commit
1780e2eb1e
3 changed files with 21 additions and 8 deletions
|
@ -69,6 +69,7 @@ struct FmtPart {
|
|||
enum {
|
||||
RIGHT = 0,
|
||||
LEFT = 1,
|
||||
NUMERIC = 2,
|
||||
} justify = RIGHT;
|
||||
char padding = '\0';
|
||||
size_t width = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue