00001 #pragma ident "$Id: mergePCodeWords.h 2943 2011-10-25 17:17:11Z yanweignss $" 00002 00003 00004 00005 //============================================================================ 00006 // 00007 // This file is part of GPSTk, the GPS Toolkit. 00008 // 00009 // The GPSTk is free software; you can redistribute it and/or modify 00010 // it under the terms of the GNU Lesser General Public License as published 00011 // by the Free Software Foundation; either version 2.1 of the License, or 00012 // any later version. 00013 // 00014 // The GPSTk is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 // GNU Lesser General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU Lesser General Public 00020 // License along with GPSTk; if not, write to the Free Software Foundation, 00021 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 // 00023 // Copyright 2004, The University of Texas at Austin 00024 // 00025 //============================================================================ 00026 00027 00028 00029 /* 00030 * mergePCodeWords - Helper function used in X2Sequence and GenXSequence 00031 00032 Given two bit-packed integers, merge the lower portion of the 00033 first and the higher portion of the second into a new bit-packed 00034 integer. The first_bit argument defines the most significant 00035 bit of the merged word. The bits are numbered from 0 - MAX_BIT-1. 00036 */ 00037 00038 #include "gpstkplatform.h" 00039 00040 #ifndef MERGEPCODEWORDS_H 00041 #define MERGEPCODEWORDS_H 00042 00043 inline uint32_t merge( uint32_t w1, 00044 uint32_t w2, 00045 int first_bit ) 00046 { 00047 uint32_t outword = w1; 00048 if (first_bit==0) return(outword); 00049 00050 outword <<= first_bit; 00051 outword |= w2 >> (gpstk::MAX_BIT - first_bit); 00052 00053 return(outword); 00054 } 00055 00056 #endif // end of MERGEPCODEWORDS_H
1.3.9.1