diff options
| author | Paul Eggert | 2018-09-04 19:14:01 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-09-04 19:15:57 -0700 |
| commit | ecb985c10d5241a65ab9552ebfcecaa150b35427 (patch) | |
| tree | c4f12a76561d84518c597cb8e25cfd3813023456 /src/editfns.c | |
| parent | e3661f8c35b3057c58e8c0b474f597697ce413ba (diff) | |
| download | emacs-ecb985c10d5241a65ab9552ebfcecaa150b35427.tar.gz emacs-ecb985c10d5241a65ab9552ebfcecaa150b35427.zip | |
Simplify bignum->intmax conversion
* src/lisp.h (integer_to_intmax, integer_to_uintmax): New functions.
* src/data.c (cons_to_unsigned, cons_to_signed)
(arith_driver):
* src/dbusbind.c (xd_extract_signed, xd_extract_unsigned):
* src/dispnew.c (sit_for):
* src/editfns.c (styled_format):
* src/emacs-module.c (module_extract_integer):
* src/fileio.c (file_offset):
* src/font.c (font_unparse_xlfd, Fopen_font):
* src/xdisp.c (calc_line_height_property):
* src/process.c (handle_child_signal):
Diffstat (limited to 'src/editfns.c')
| -rw-r--r-- | src/editfns.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/editfns.c b/src/editfns.c index 3b1c21a1781..4ea70253793 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -4691,21 +4691,16 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 4691 | } | 4691 | } |
| 4692 | else | 4692 | else |
| 4693 | { | 4693 | { |
| 4694 | if (FIXNUMP (arg)) | 4694 | if (INTEGERP (arg)) |
| 4695 | ldarg = XFIXNUM (arg); | ||
| 4696 | else | ||
| 4697 | { | 4695 | { |
| 4698 | intmax_t iarg = bignum_to_intmax (arg); | 4696 | intmax_t iarg; |
| 4699 | if (iarg != 0) | 4697 | uintmax_t uarg; |
| 4698 | if (integer_to_intmax (arg, &iarg)) | ||
| 4700 | ldarg = iarg; | 4699 | ldarg = iarg; |
| 4700 | else if (integer_to_uintmax (arg, &uarg)) | ||
| 4701 | ldarg = uarg; | ||
| 4701 | else | 4702 | else |
| 4702 | { | 4703 | format_bignum_as_double = true; |
| 4703 | uintmax_t uarg = bignum_to_uintmax (arg); | ||
| 4704 | if (uarg != 0) | ||
| 4705 | ldarg = uarg; | ||
| 4706 | else | ||
| 4707 | format_bignum_as_double = true; | ||
| 4708 | } | ||
| 4709 | } | 4704 | } |
| 4710 | if (!format_bignum_as_double) | 4705 | if (!format_bignum_as_double) |
| 4711 | { | 4706 | { |