First public contribution.
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include <3gplibrary/mp4config.h>
21 * mp4_u16 u16endian(mp4_u16 u)
25 * This function converts the input parameter u between network byte
26 * order (big endian) and current computer byte order.
28 * Note: Intel based Windows system is little endian.
29 * ARM based Symbian OS is little endian.
40 mp4_u16 u16endian(mp4_u16 u)
44 ((mp4_u8 *)&result)[0] = ((mp4_u8 *)&u)[1];
45 ((mp4_u8 *)&result)[1] = ((mp4_u8 *)&u)[0];
54 * mp4_u32 u32endian(mp4_u32 u)
58 * This function converts the input parameter u between network byte
59 * order (big endian) and current computer byte order.
61 * Note: Intel based Windows system is little endian.
62 * ARM based Symbian OS is little endian.
73 mp4_u32 u32endian(mp4_u32 u)
77 ((mp4_u8 *)&result)[0] = ((mp4_u8 *)&u)[3];
78 ((mp4_u8 *)&result)[1] = ((mp4_u8 *)&u)[2];
79 ((mp4_u8 *)&result)[2] = ((mp4_u8 *)&u)[1];
80 ((mp4_u8 *)&result)[3] = ((mp4_u8 *)&u)[0];
89 * mp4_i32 i32endian(mp4_i32 i)
93 * This function converts the input parameter i between network byte
94 * order (big endian) and current computer byte order.
96 * Note: Intel based Windows system is little endian.
97 * ARM based Symbian OS is little endian.
108 mp4_i32 i32endian(mp4_i32 i)
112 ((mp4_u8 *)&result)[0] = ((mp4_u8 *)&i)[3];
113 ((mp4_u8 *)&result)[1] = ((mp4_u8 *)&i)[2];
114 ((mp4_u8 *)&result)[2] = ((mp4_u8 *)&i)[1];
115 ((mp4_u8 *)&result)[3] = ((mp4_u8 *)&i)[0];
124 * mp4_u64 u64endian(mp4_u64 u)
128 * This function converts the input parameter u between network byte
129 * order (big endian) and current computer byte order.
131 * Note: Intel based Windows system is little endian.
132 * ARM based Symbian OS is little endian.
143 mp4_u64 u64endian(mp4_u64 u)
147 ((mp4_u8 *)&result)[0] = ((mp4_u8 *)&u)[7];
148 ((mp4_u8 *)&result)[1] = ((mp4_u8 *)&u)[6];
149 ((mp4_u8 *)&result)[2] = ((mp4_u8 *)&u)[5];
150 ((mp4_u8 *)&result)[3] = ((mp4_u8 *)&u)[4];
151 ((mp4_u8 *)&result)[4] = ((mp4_u8 *)&u)[3];
152 ((mp4_u8 *)&result)[5] = ((mp4_u8 *)&u)[2];
153 ((mp4_u8 *)&result)[6] = ((mp4_u8 *)&u)[1];
154 ((mp4_u8 *)&result)[7] = ((mp4_u8 *)&u)[0];