*** /dev/null Thu Dec 16 11:30:01 2010 --- src/switch_mask.c Thu Dec 16 11:31:53 2010 *************** *** 0 **** --- 1,60 ---- + /* + * Switch_mask - utility function for creating a mask; taken from + * bit_operations.c - Various bit level operations, such as bit reversal + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + /*! \file */ + + #if defined(HAVE_CONFIG_H) + #include "config.h" + #endif + + #include + #include + #include + #include + #include + #include + + #include "spandsp/telephony.h" + + SPAN_DECLARE(uint32_t) make_mask32(uint32_t x) + { + x |= (x >> 1); + x |= (x >> 2); + x |= (x >> 4); + x |= (x >> 8); + x |= (x >> 16); + return x; + } + /*- End of function --------------------------------------------------------*/ + + SPAN_DECLARE(uint16_t) make_mask16(uint16_t x) + { + x |= (x >> 1); + x |= (x >> 2); + x |= (x >> 4); + x |= (x >> 8); + return x; + } + /*- End of function --------------------------------------------------------*/ + /*- End of file ------------------------------------------------------------*/