[PATCH v2 2/2] soft-fp: Add inplementation for 128 bit self-contained
Joseph Myers
joseph@codesourcery.com
Wed Oct 31 17:26:00 GMT 2018
On Wed, 31 Oct 2018, Zong Li wrote:
> + R##_f[_FP_FRAC_ADD_8_i] \
> + = X##_f[_FP_FRAC_ADD_8_i] \
> + + Y##_f[_FP_FRAC_ADD_8_i] \
> + + _FP_FRAC_ADD_8_c; \
For these sorts of expressions broken over multiple lines, please see the
GNU Coding Standards:
Insert extra parentheses so that Emacs will indent the code properly.
For example, the following indentation looks nice if you do it by hand,
@example
v = rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000
+ rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000;
@end example
@noindent
but Emacs would alter it. Adding a set of parentheses produces
something that looks equally nice, and which Emacs will preserve:
@example
v = (rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000
+ rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000);
@end example
So, you should have parentheses around the RHS of '=' here to ensure it
stays properly indented across future edits (rather than the '+' ending up
in the same column as '=', which is what would happen without those
parentheses).
> + _FP_FRAC_SUB_8_tmp[_FP_FRAC_SUB_8_i] \
> + = X##_f[_FP_FRAC_SUB_8_i] \
> + - Y##_f[_FP_FRAC_SUB_8_i] \
> + - _FP_FRAC_SUB_8_c; \
Likewise here.
> + _FP_FRAC_SUB_8_c \
> + = (_FP_FRAC_SUB_8_c \
> + ? _FP_FRAC_SUB_8_tmp[_FP_FRAC_SUB_8_i] \
> + >= X##_f[_FP_FRAC_SUB_8_i] \
> + : _FP_FRAC_SUB_8_tmp[_FP_FRAC_SUB_8_i] \
> + > X##_f[_FP_FRAC_SUB_8_i]); \
Likewise for the '>=' and '>' expressions as operands of ?:.
> + for (_FP_FRAC_SUB_8_i = 0; _FP_FRAC_SUB_8_i < 8; ++_FP_FRAC_SUB_8_i) \
> + { \
> + R##_f[_FP_FRAC_SUB_8_i] = _FP_FRAC_SUB_8_tmp[_FP_FRAC_SUB_8_i]; \
> + } \
When there is only a single statement in a block, we don't generally use {
} around that block.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libc-alpha
mailing list