Mercurial > emacs
comparison src/data.c @ 21819:c98ba82f4b52
(Flsh, Fash): Handle out-of-range shift counts reasonably.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 29 Apr 1998 00:59:22 +0000 |
parents | b90287cb111a |
children | 7f45fb4c0a1f |
comparison
equal
deleted
inserted
replaced
21818:af741167f81e | 21819:c98ba82f4b52 |
---|---|
2479 register Lisp_Object val; | 2479 register Lisp_Object val; |
2480 | 2480 |
2481 CHECK_NUMBER (value, 0); | 2481 CHECK_NUMBER (value, 0); |
2482 CHECK_NUMBER (count, 1); | 2482 CHECK_NUMBER (count, 1); |
2483 | 2483 |
2484 if (XINT (count) > 0) | 2484 if (XINT (count) >= BITS_PER_EMACS_INT) |
2485 XSETINT (val, 0); | |
2486 else if (XINT (count) > 0) | |
2485 XSETINT (val, XINT (value) << XFASTINT (count)); | 2487 XSETINT (val, XINT (value) << XFASTINT (count)); |
2488 else if (XINT (count) <= -BITS_PER_EMACS_INT) | |
2489 XSETINT (val, XINT (value) < 0 ? -1 : 0); | |
2486 else | 2490 else |
2487 XSETINT (val, XINT (value) >> -XINT (count)); | 2491 XSETINT (val, XINT (value) >> -XINT (count)); |
2488 return val; | 2492 return val; |
2489 } | 2493 } |
2490 | 2494 |
2498 register Lisp_Object val; | 2502 register Lisp_Object val; |
2499 | 2503 |
2500 CHECK_NUMBER (value, 0); | 2504 CHECK_NUMBER (value, 0); |
2501 CHECK_NUMBER (count, 1); | 2505 CHECK_NUMBER (count, 1); |
2502 | 2506 |
2503 if (XINT (count) > 0) | 2507 if (XINT (count) >= BITS_PER_EMACS_INT) |
2508 XSETINT (val, 0); | |
2509 else if (XINT (count) > 0) | |
2504 XSETINT (val, (EMACS_UINT) XUINT (value) << XFASTINT (count)); | 2510 XSETINT (val, (EMACS_UINT) XUINT (value) << XFASTINT (count)); |
2511 else if (XINT (count) <= -BITS_PER_EMACS_INT) | |
2512 XSETINT (val, 0); | |
2505 else | 2513 else |
2506 XSETINT (val, (EMACS_UINT) XUINT (value) >> -XINT (count)); | 2514 XSETINT (val, (EMACS_UINT) XUINT (value) >> -XINT (count)); |
2507 return val; | 2515 return val; |
2508 } | 2516 } |
2509 | 2517 |