Mercurial > emacs
changeset 53910:9c480a55fc22
* data.c (Fbyteorder): New function.
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Tue, 10 Feb 2004 17:18:34 +0000 |
parents | 3d23cd8c7b15 |
children | 609de9ab5f75 |
files | src/data.c |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/data.c Tue Feb 10 17:14:51 2004 +0000 +++ b/src/data.c Tue Feb 10 17:18:34 2004 +0000 @@ -2879,6 +2879,20 @@ XSETINT (number, ~XINT (number)); return number; } + +DEFUN ("byteorder", Fbyteorder, Sbyteorder, 0, 0, 0, + doc: /* Return the byteorder for the machine. +Returns 66 (ASCII uppercase B) for big endian machines or 108 (ASCII +lowercase l) for small endian machines. */) + () +{ + unsigned i = 0x04030201; + int order = *(char *)&i == 4 ? 66 : 108; + + return XFASTINT (order); +} + + void syms_of_data () @@ -3281,6 +3295,7 @@ defsubr (&Sadd1); defsubr (&Ssub1); defsubr (&Slognot); + defsubr (&Sbyteorder); defsubr (&Ssubr_arity); XSYMBOL (Qwholenump)->function = XSYMBOL (Qnatnump)->function;