xref: /titanic_41/usr/src/uts/common/gssapi/mechs/krb5/include/k5-platform-store_64.h (revision 159d09a20817016f09b3ea28d1bdada4a336bb91)
1 /*
2  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 
7 /*
8  * k5-platform.h
9  *
10  * Copyright 2003, 2004, 2005 Massachusetts Institute of Technology.
11  * All Rights Reserved.
12  *
13  * Export of this software from the United States of America may
14  *   require a specific license from the United States Government.
15  *   It is the responsibility of any person or organization contemplating
16  *   export to obtain such a license before exporting.
17  *
18  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
19  * distribute this software and its documentation for any purpose and
20  * without fee is hereby granted, provided that the above copyright
21  * notice appear in all copies and that both that copyright notice and
22  * this permission notice appear in supporting documentation, and that
23  * the name of M.I.T. not be used in advertising or publicity pertaining
24  * to distribution of the software without specific, written prior
25  * permission.	Furthermore if you modify this software you must label
26  * your software as modified software and not distribute it in such a
27  * fashion that it might be confused with the original M.I.T. software.
28  * M.I.T. makes no representations about the suitability of
29  * this software for any purpose.  It is provided "as is" without express
30  * or implied warranty.
31  *
32  *
33  * Some platform-dependent definitions to sync up the C support level.
34  * Some to a C99-ish level, some related utility code.
35  *
36  * Currently:
37  * + make "static inline" work
38  * + 64-bit types and load/store code
39  * + SIZE_MAX
40  * + shared library init/fini hooks
41  * + consistent getpwnam/getpwuid interfaces
42  */
43 
44 static void
store_64_be(UINT64_TYPE val,unsigned char * p)45 store_64_be (UINT64_TYPE val, unsigned char *p)
46 {
47     p[0] = (unsigned char)((val >> 56) & 0xff);
48     p[1] = (unsigned char)((val >> 48) & 0xff);
49     p[2] = (unsigned char)((val >> 40) & 0xff);
50     p[3] = (unsigned char)((val >> 32) & 0xff);
51     p[4] = (unsigned char)((val >> 24) & 0xff);
52     p[5] = (unsigned char)((val >> 16) & 0xff);
53     p[6] = (unsigned char)((val >>  8) & 0xff);
54     p[7] = (unsigned char)((val      ) & 0xff);
55 }
56 
57