1 /* SPDX-License-Identifier: Intel */
3 * Copyright (C) 2013, Intel Corporation
4 * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com>
7 #ifndef __SIGNATURES_H__
8 #define __SIGNATURES_H__
11 * Returns a 16-bit signature built from 2 ASCII characters.
13 * This macro returns a 16-bit value built from the two ASCII characters
14 * specified by A and B.
16 * @A: The first ASCII character.
17 * @B: The second ASCII character.
19 * @return: A 16-bit value built from the two ASCII characters specified by
22 #define SIGNATURE_16(A, B) ((A) | (B << 8))
25 * Returns a 32-bit signature built from 4 ASCII characters.
27 * This macro returns a 32-bit value built from the four ASCII characters
28 * specified by A, B, C, and D.
30 * @A: The first ASCII character.
31 * @B: The second ASCII character.
32 * @C: The third ASCII character.
33 * @D: The fourth ASCII character.
35 * @return: A 32-bit value built from the two ASCII characters specified by
38 #define SIGNATURE_32(A, B, C, D) \
39 (SIGNATURE_16(A, B) | (SIGNATURE_16(C, D) << 16))
42 * Returns a 64-bit signature built from 8 ASCII characters.
44 * This macro returns a 64-bit value built from the eight ASCII characters
45 * specified by A, B, C, D, E, F, G,and H.
47 * @A: The first ASCII character.
48 * @B: The second ASCII character.
49 * @C: The third ASCII character.
50 * @D: The fourth ASCII character.
51 * @E: The fifth ASCII character.
52 * @F: The sixth ASCII character.
53 * @G: The seventh ASCII character.
54 * @H: The eighth ASCII character.
56 * @return: A 64-bit value built from the two ASCII characters specified by
57 * A, B, C, D, E, F, G and H.
59 #define SIGNATURE_64(A, B, C, D, E, F, G, H) \
60 (SIGNATURE_32(A, B, C, D) | ((u64)(SIGNATURE_32(E, F, G, H)) << 32))
62 #endif /* __SIGNATURES_H__ */