1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 #include "osclconfig.h" 19 #include "oscl_int64_utils.h" 20 21 OSCL_EXPORT_REF void Oscl_Int64_Utils::set_int64(int64& input_value, const int32 upper, const int32 lower) 22 { 23 input_value = (int64)((int64(upper) << 32) | lower); 24 }; 25 26 27 OSCL_EXPORT_REF int32 Oscl_Int64_Utils::get_int64_upper32(const int64& input_value) 28 { 29 return (int32)((input_value >> 32) & 0xFFFFFFFF); 30 }; 31 32 33 OSCL_EXPORT_REF int32 Oscl_Int64_Utils::get_int64_lower32(const int64& input_value) 34 { 35 return (int32)((input_value) & 0xFFFFFFFF); 36 }; 37 38 39 OSCL_EXPORT_REF int32 Oscl_Int64_Utils::get_int64_middle32(const int64& input_value) 40 { 41 return (int32)((input_value >> 16) & 0xFFFFFFFF); 42 }; 43 44 45 OSCL_EXPORT_REF void Oscl_Int64_Utils::set_uint64(uint64& input_value, const uint32 upper, const uint32 lower) 46 { 47 input_value = (uint64)((uint64(upper) << 32) | lower); 48 }; 49 50 51 OSCL_EXPORT_REF uint32 Oscl_Int64_Utils::get_uint64_upper32(const uint64& input_value) 52 { 53 return (uint32)((input_value >> 32) & 0xFFFFFFFF); 54 }; 55 56 57 OSCL_EXPORT_REF uint32 Oscl_Int64_Utils::get_uint64_lower32(const uint64& input_value) 58 { 59 return (uint32)((input_value) & 0xFFFFFFFF); 60 }; 61 62 63 OSCL_EXPORT_REF uint32 Oscl_Int64_Utils::get_uint64_middle32(const uint64& input_value) 64 { 65 return (uint32)((input_value >> 16) & 0xFFFFFFFF); 66 }; 67