18b52a31eSHanoh Haim#ifndef BIG_ENDIAN_BIT_MAN_H
28b52a31eSHanoh Haim#define BIG_ENDIAN_BIT_MAN_H
38b52a31eSHanoh Haim/*
48b52a31eSHanoh HaimCopyright (c) 2015-2015 Cisco Systems, Inc.
58b52a31eSHanoh Haim
68b52a31eSHanoh HaimLicensed under the Apache License, Version 2.0 (the "License");
78b52a31eSHanoh Haimyou may not use this file except in compliance with the License.
88b52a31eSHanoh HaimYou may obtain a copy of the License at
98b52a31eSHanoh Haim
108b52a31eSHanoh Haim    http://www.apache.org/licenses/LICENSE-2.0
118b52a31eSHanoh Haim
128b52a31eSHanoh HaimUnless required by applicable law or agreed to in writing, software
138b52a31eSHanoh Haimdistributed under the License is distributed on an "AS IS" BASIS,
148b52a31eSHanoh HaimWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
158b52a31eSHanoh HaimSee the License for the specific language governing permissions and
168b52a31eSHanoh Haimlimitations under the License.
178b52a31eSHanoh Haim*/
188b52a31eSHanoh Haim
198b52a31eSHanoh Haim#include "bitMan.h"
208b52a31eSHanoh Haim
218b52a31eSHanoh Haiminline void setMaskBit8(uint8_t & a,
228b52a31eSHanoh Haim                        int           startbit,
238b52a31eSHanoh Haim                        int           stopbit,
248b52a31eSHanoh Haim                        uint8_t newVal )
258b52a31eSHanoh Haim{
268b52a31eSHanoh Haim    btSetMaskBitBigE8(a, startbit, stopbit, newVal);
278b52a31eSHanoh Haim}
288b52a31eSHanoh Haim
298b52a31eSHanoh Haim
308b52a31eSHanoh Haiminline void setMaskBit16(uint16_t & a,
318b52a31eSHanoh Haim                         int           startbit,
328b52a31eSHanoh Haim                         int           stopbit,
338b52a31eSHanoh Haim                         uint16_t newVal )
348b52a31eSHanoh Haim{
358b52a31eSHanoh Haim    btSetMaskBitBigE16(a, startbit, stopbit, newVal);
368b52a31eSHanoh Haim}
378b52a31eSHanoh Haim
388b52a31eSHanoh Haim
398b52a31eSHanoh Haiminline void setMaskBit32(uint32_t   & a,
408b52a31eSHanoh Haim                         int           startbit,
418b52a31eSHanoh Haim                         int           stopbit,
428b52a31eSHanoh Haim                         uint32_t newVal )
438b52a31eSHanoh Haim{
448b52a31eSHanoh Haim    btSetMaskBitBigE32(a, startbit, stopbit, newVal);
458b52a31eSHanoh Haim}
468b52a31eSHanoh Haim
478b52a31eSHanoh Haim
488b52a31eSHanoh Haim
498b52a31eSHanoh Haim
508b52a31eSHanoh Haiminline unsigned char getMaskBit8(uint8_t   a,
518b52a31eSHanoh Haim                                 int             startbit,
528b52a31eSHanoh Haim                                 int             stopbit) {
538b52a31eSHanoh Haim     return btGetMaskBitBigE8(a,startbit,stopbit);
548b52a31eSHanoh Haim}
558b52a31eSHanoh Haim
568b52a31eSHanoh Haim
578b52a31eSHanoh Haiminline unsigned short getMaskBit16(uint16_t a,
588b52a31eSHanoh Haim                                  int            startbit,
598b52a31eSHanoh Haim                                  int            stopbit) {
608b52a31eSHanoh Haim     return btGetMaskBitBigE16(a,startbit,stopbit);
618b52a31eSHanoh Haim}
628b52a31eSHanoh Haim
638b52a31eSHanoh Haim
648b52a31eSHanoh Haiminline unsigned long   getMaskBit32(uint32_t   a,
658b52a31eSHanoh Haim                                 int             startbit,
668b52a31eSHanoh Haim                                 int             stopbit) {
678b52a31eSHanoh Haim     return btGetMaskBitBigE32(a,startbit,stopbit);
688b52a31eSHanoh Haim}
698b52a31eSHanoh Haim
708b52a31eSHanoh Haim
718b52a31eSHanoh Haim#endif // BIG_ENDIAN_BIT_MAN_H
728b52a31eSHanoh Haim
738b52a31eSHanoh Haim
74