1 /***************************************************************************
2 * Copyright (c) 2024 Microsoft Corporation
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the MIT License which is available at
6 * https://opensource.org/licenses/MIT.
7 *
8 * SPDX-License-Identifier: MIT
9 **************************************************************************/
10
11
12 /**************************************************************************/
13 /**************************************************************************/
14 /** */
15 /** FileX Component */
16 /** */
17 /** Utility */
18 /** */
19 /**************************************************************************/
20 /**************************************************************************/
21
22 #define FX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26
27 #include "fx_api.h"
28 #include "fx_system.h"
29 #include "fx_utility.h"
30
31
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _fx_utility_16_unsigned_read PORTABLE C */
37 /* 6.1 */
38 /* AUTHOR */
39 /* */
40 /* William E. Lamie, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This function reads (with endian awareness) 16-bit unsigned data */
45 /* from the specified source and returns the value to the caller. */
46 /* */
47 /* INPUT */
48 /* */
49 /* source_ptr Source memory pointer */
50 /* */
51 /* OUTPUT */
52 /* */
53 /* UINT value */
54 /* */
55 /* CALLS */
56 /* */
57 /* None */
58 /* */
59 /* CALLED BY */
60 /* */
61 /* FileX System Functions */
62 /* */
63 /* RELEASE HISTORY */
64 /* */
65 /* DATE NAME DESCRIPTION */
66 /* */
67 /* 05-19-2020 William E. Lamie Initial Version 6.0 */
68 /* 09-30-2020 William E. Lamie Modified comment(s), */
69 /* resulting in version 6.1 */
70 /* */
71 /**************************************************************************/
_fx_utility_16_unsigned_read(UCHAR * source_ptr)72 UINT _fx_utility_16_unsigned_read(UCHAR *source_ptr)
73 {
74
75 UINT value;
76
77 /* Pickup the UINT from the destination with endian-awareness. */
78 value = ((((UINT)*(source_ptr + 1)) & 0xFF) << 8) |
79 ((UINT)*(source_ptr) & 0xFF);
80
81 /* Return value to caller. */
82 return(value);
83 }
84
85