18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Driver for the Conexant CX25821 PCIe bridge 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2009 Conexant Systems Inc. 68c2ecf20Sopenharmony_ci * Authors <shu.lin@conexant.com>, <hiep.huynh@conexant.com> 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#ifndef _BITFUNCS_H 108c2ecf20Sopenharmony_ci#define _BITFUNCS_H 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#define SetBit(Bit) (1 << Bit) 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_cistatic inline u8 getBit(u32 sample, u8 index) 158c2ecf20Sopenharmony_ci{ 168c2ecf20Sopenharmony_ci return (u8) ((sample >> index) & 1); 178c2ecf20Sopenharmony_ci} 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_cistatic inline u32 clearBitAtPos(u32 value, u8 bit) 208c2ecf20Sopenharmony_ci{ 218c2ecf20Sopenharmony_ci return value & ~(1 << bit); 228c2ecf20Sopenharmony_ci} 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_cistatic inline u32 setBitAtPos(u32 sample, u8 bit) 258c2ecf20Sopenharmony_ci{ 268c2ecf20Sopenharmony_ci sample |= (1 << bit); 278c2ecf20Sopenharmony_ci return sample; 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci} 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#endif 32