audk/MdePkg/Library/BaseSafeIntLib
Laszlo Ersek 8c33cc0ec9 MdePkg/BaseSafeIntLib: clean up parentheses in MIN_INT64_MAGNITUDE
The definition of the MIN_INT64_MAGNITUDE macro is correct, but it's
harder to read than necessary: the sub-expression

      (( (UINT64) - (MIN_INT64 + 1) ))

is doubly parenthesized. Reusing one pair of the outer parens, rewrite the
sub-expression (without change in meaning) so that the minus sign cannot
be mistaken for subtraction:

      ( (UINT64)(- (MIN_INT64 + 1)) )

The resultant macro definition matches the following expressions in
SafeInt64Mult():

>     //
>     // Avoid negating the most negative number.
>     //
>     UnsignedMultiplicand = ((UINT64)(- (Multiplicand + 1))) + 1;

and

>     //
>     // Avoid negating the most negative number.
>     //
>     UnsignedMultiplier = ((UINT64)(- (Multiplier + 1))) + 1;

Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Michael D Kinney <michael.d.kinney@intel.com>
2018-02-21 11:57:36 +01:00
..
BaseSafeIntLib.inf MdePkg/BaseSafeIntLib: Add SafeIntLib class and instance 2018-01-25 09:42:20 -08:00
SafeIntLib.c MdePkg/BaseSafeIntLib: clean up parentheses in MIN_INT64_MAGNITUDE 2018-02-21 11:57:36 +01:00
SafeIntLib32.c MdePkg/BaseSafeIntLib: Add SafeIntLib class and instance 2018-01-25 09:42:20 -08:00
SafeIntLib64.c MdePkg/BaseSafeIntLib: Add SafeIntLib class and instance 2018-01-25 09:42:20 -08:00
SafeIntLibEbc.c MdePkg/BaseSafeIntLib: Add SafeIntLib class and instance 2018-01-25 09:42:20 -08:00