X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Flib%2Fgscplftaaux%2Frts_byteswap.c;h=cae7ea21b226acbcc4c3ebf002e1fbbf867f7440;hb=7cec316889150a8a92238e52c7bad1270608b333;hp=5ed42d0d72a975ba41718f0d469f6313a81f9ce5;hpb=07495effe193ca3f73c3bf0ce417068f9ac9dcdd;p=com%2Fgs-lite.git diff --git a/src/lib/gscplftaaux/rts_byteswap.c b/src/lib/gscplftaaux/rts_byteswap.c index 5ed42d0..cae7ea2 100644 --- a/src/lib/gscplftaaux/rts_byteswap.c +++ b/src/lib/gscplftaaux/rts_byteswap.c @@ -1,42 +1,42 @@ -#include "gsconfig.h" -#include "gstypes.h" - -/* ------------------------------------------------ -Copyright 2014 AT&T Intellectual Property - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ------------------------------------------- */ - - -gs_int16_t gscpbswap16(gs_int16_t x){ - return ((x << 8) & 0xff00) | ((x >> 8) & 0x00ff); -} - -gs_int32_t gscpbswap32(gs_int32_t x ) { - return ((x << 24) & 0xff000000 ) | - ((x << 8) & 0x00ff0000 ) | - ((x >> 8) & 0x0000ff00 ) | - ((x >> 24) & 0x000000ff ); -} - - -gs_int64_t gscpbswap64(gs_int64_t x) { - gs_uint64_t t1; - gs_uint64_t t2; - t1=x>>32; - t1 = gscpbswap32(t1); - t2=x & 0xffffffff; - t2 = gscpbswap32(t2); - x = t2<<32; - x = x|t1; - return x; -} +#include "gsconfig.h" +#include "gstypes.h" + +/* ------------------------------------------------ +Copyright 2014 AT&T Intellectual Property + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ------------------------------------------- */ + + +gs_int16_t gscpbswap16(gs_int16_t x){ + return ((x << 8) & 0xff00) | ((x >> 8) & 0x00ff); +} + +gs_int32_t gscpbswap32(gs_int32_t x ) { + return ((x << 24) & 0xff000000 ) | + ((x << 8) & 0x00ff0000 ) | + ((x >> 8) & 0x0000ff00 ) | + ((x >> 24) & 0x000000ff ); +} + + +gs_int64_t gscpbswap64(gs_int64_t x) { + gs_uint64_t t1; + gs_uint64_t t2; + t1=x>>32; + t1 = gscpbswap32(t1); + t2=x & 0xffffffff; + t2 = gscpbswap32(t2); + x = t2<<32; + x = x|t1; + return x; +}