[Git][NTPsec/ntpsec][master] 4 commits: ieee754: remove redundant shifts and redundant else.
Gary E. Miller
gitlab at mg.gitlab.com
Wed Apr 5 03:31:27 UTC 2017
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
521737a9 by Gary E. Miller at 2017-04-04T20:08:40-07:00
ieee754: remove redundant shifts and redundant else.
tests still pass.
- - - - -
aab6f030 by Gary E. Miller at 2017-04-04T20:14:39-07:00
ieee754: remove much pointless shifting of zero.
All tests pass.
- - - - -
aa89df98 by Gary E. Miller at 2017-04-04T20:25:50-07:00
ieee754io: remopve more pointless shifts.
All tests pass.
- - - - -
afa7449c by Gary E. Miller at 2017-04-04T20:27:19-07:00
waf: enable -Wsign-conversion.
All sign-conversion warnings fixed, except 2 weird ones in Bison...
- - - - -
2 changed files:
- libparse/ieee754io.c
- wafhelpers/configure.py
Changes:
=====================================
libparse/ieee754io.c
=====================================
--- a/libparse/ieee754io.c
+++ b/libparse/ieee754io.c
@@ -283,37 +283,39 @@ fetch_ieee754(
* 64 bit operations 8-(
*/
if (frac_offset > mbits) {
- setlfpuint(*lfpp, 0); /* only fractional number */
frac_offset -= mbits + 1; /* will now contain right shift count - 1*/
if (mbits > 31) {
uint32_t frac;
frac = mantissa_high << (63 - mbits);
frac |= mantissa_low >> (mbits - 33);
frac >>= frac_offset;
- setlfpfrac(*lfpp, frac);
+ *lfpp = lfpfrac(frac);
} else {
- setlfpfrac(*lfpp, mantissa_low >> frac_offset);
+ *lfpp = lfpfrac( mantissa_low >> frac_offset);
}
+ } else if (frac_offset > 32) {
+ /*
+ * must split in high word
+ */
+ *lfpp = lfptouint(mantissa_high >> (frac_offset - 32));
+ *lfpp |= lfpfrac(((mantissa_high &
+ ((1U << (frac_offset - 32)) - 1)) << (64 - frac_offset)) |
+ (mantissa_low >> (frac_offset - 32)));
} else {
- if (frac_offset > 32) {
- /*
- * must split in high word
- */
- setlfpuint(*lfpp, mantissa_high >> (frac_offset - 32));
- setlfpfrac(*lfpp, ((mantissa_high & ((1 << (frac_offset - 32)) - 1)) << (64 - frac_offset)) | (mantissa_low >> (frac_offset - 32)));
- } else {
- /*
- * must split in low word
- */
- setlfpuint(*lfpp, (mantissa_high << (32 - frac_offset)) | (((mantissa_low >> frac_offset) & ((1 << (32 - frac_offset)) - 1))));
- /* coverity[large_shift] */
- setlfpfrac(*lfpp, (mantissa_low & ((1 << frac_offset) - 1)) << (32 - frac_offset));
- }
+ /*
+ * must split in low word
+ */
+ *lfpp = lfptouint((mantissa_high << (32 - frac_offset)) |
+ (((mantissa_low >> frac_offset) &
+ ((1U << (32 - frac_offset)) - 1))));
+ /* coverity[large_shift] */
+ *lfpp |= lfpfrac((mantissa_low &
+ ((1U << frac_offset) - 1)) << (32 - frac_offset));
}
/*
- * adjust for sign
- */
+ * adjust for sign
+ */
if (sign) {
L_NEG(*lfpp);
}
=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -279,7 +279,7 @@ def cmd_configure(ctx, config):
# "-Wfloat-equal", # Not Ready For Prime Time
# "-Wmissing-prototypes", # Not Ready For Prime Time
# "-Wmissing-declarations", # Not Ready For Primt Time
- # "-Wsign-conversion", # Not Ready For Prime Time
+ "-Wsign-conversion",
"-Wshadow",
"-Wstrict-prototypes",
"-Wundef",
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/067a7f0ad079181d5b8b201d818b60f256e23dec...afa7449cc46fd64e02d05d7617dd565bcf1e05c4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170405/89b3534c/attachment.html>
More information about the vc
mailing list