3 * ================================================================
4 * SourcePawn, Copyright (C) 2004-2007 AlliedModders LLC.
6 * ================================================================
8 * This file is part of the SourceMod/SourcePawn SDK. This file may only be
9 * used or modified under the Terms and Conditions of its License Agreement,
10 * which is found in public/licenses/LICENSE.txt. As of this notice, derivative
11 * works must be licensed under the GNU General Public License (version 2 or
12 * greater). A copy of the GPL is included under public/licenses/GPL.txt.
14 * To view the latest information, see: http://www.sourcemod.net/license.php
19 #ifndef _INCLUDE_SOURCEPAWN_VM_TYPEUTIL_H_
20 #define _INCLUDE_SOURCEPAWN_VM_TYPEUTIL_H_
24 * @brief Defines type utility functions.
27 #include "sp_vm_types.h"
30 * @brief Reinterpret-casts a float to a cell (requires -fno-strict-aliasing for GCC).
32 * @param val Float value.
33 * @return Cell typed version.
35 inline cell_t sp_ftoc(float val)
37 return *(cell_t *)&val;
41 * @brief Reinterpret-casts a cell to a float (requires -fno-strict-aliasing for GCC).
43 * @param val Cell-packed float value.
44 * @return Float typed version.
46 inline float sp_ctof(cell_t val)
48 return *(float *)&val;
51 #endif //_INCLUDE_SOURCEPAWN_VM_TYPEUTIL_H_