<commit_before>#ifndef US_BITS_H
#define US_BITS_H

/*
Copyright (c) 2011, Meyer Sound Laboratories, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of the Meyer Sound Laboratories, Inc. nor the
      names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL MEYER SOUND LABORATORIES, INC. BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef US_WORLD_H
#include "us_world.h"
#endif

#define US_BITS_GET_OCTET_0 US_GET_BYTE_0
#define US_BITS_GET_OCTET_1 US_GET_BYTE_1
#define US_BITS_GET_OCTET_2 US_GET_BYTE_2
#define US_BITS_GET_OCTET_3 US_GET_BYTE_3
#define US_BITS_GET_OCTET_4 US_GET_BYTE_4
#define US_BITS_GET_OCTET_5 US_GET_BYTE_5
#define US_BITS_GET_OCTET_6 US_GET_BYTE_6
#define US_BITS_GET_OCTET_7 US_GET_BYTE_7

#define US_BITS_MAKE_DOUBLET( b1, b0 ) \
( (((uint16_t)(b1))<<8) | (((uint16_t)(b0))<<0) )

#define US_BITS_MAKE_QUADLET( b3, b2, b1, b0 ) \
( (((uint32_t)(b3))<<24) | (((uint32_t)(b2))<<16) | (((uint32_t)(b1))<<8) | (((uint32_t)(b0))<<0) )

#define US_BITS_MAKE_SEXLET( b5, b4, b3, b2, b1, b0 ) \
(((uint64_t)US_BITS_MAKE_QUADLET( 0, 0, (b5), (b4) )<<32) | ((uint64_t)US_BITS_MAKE_QUADLET((b3),(b2),(b1),(b0))))

#define US_BITS_MAKE_OCTLET( b7, b6, b5, b4, b3, b2, b1, b0 ) \
(((uint64_t)US_BITS_MAKE_QUADLET( (b7), (b6), (b5), (b4) )<<32) | ((uint64_t)US_BITS_MAKE_QUADLET((b3),(b2),(b1),(b0))))


/**
 \addtogroup us_bits IEEE bit packing utilities
 */

/*@{*/

#ifdef __cplusplus
extern "C"
{
#endif



    /** \addtogtoup bit_util bit utilities */

    /*@{*/

#define US_BITS_OCTET_BIT(bit) (((uint8_t)0x80)>>(bit))
#define US_BITS_DOUBLET_BIT(bit) (((uint16_t)0x8000)>>(bit))
#define US_BITS_QUADLET_BIT(bit) (((uint32_t)0x80000000)>>(bit))
#define US_BITS_SEXLET_BIT(bit) (((uint64_t)0x800000000000)>>(bit))
#define US_BITS_OCTLET_BIT(bit) (((uint64_t)0x8000000000000000)>>(bit))

#define US_BITS_OCTET_MASK_BIT(bit) ((~US_BITS_OCTET_BIT(bit))&0xff)
#define US_BITS_DOUBLET_MASK_BIT(bit) ((~US_BITS_DOUBLET_BIT(bit))&0xffff)
#define US_BITS_QUADLET_MASK_BIT(bit) ((~US_BITS_QUADLET_BIT(bit))&0xffffffff)
#define US_BITS_SEXLET_MASK_BIT(bit) ((~US_BITS_SEXLET_BIT(bit))&0xffffffffffff)
#define US_BITS_OCTLET_MASK_BIT(bit) ((~US_BITS_OCTLET_BIT(bit))&0xffffffffffffffff)

#define US_BITS_IS_BITVALUE_SET( value, bit_value ) (((value)&(bit_value))!=0)
#define US_BITS_IS_BITVALUE_CLEAR( value, bit_value ) (((value)&(bit_value))==0)

#define US_BITS_MAP_FROM_OCTET_BIT( value, bit, on, off ) ( US_BITS_IS_BITVALUE_SET(value,US_BITS_OCTET_BIT(bit)) ? (on) : (off))
#define US_BITS_MAP_FROM_DOUBLET_BIT( value, bit, on, off ) ( US_BITS_IS_BITVALUE_SET(value,US_BITS_DOUBLET_BIT(bit)) ? (on) : (off))
#define US_BITS_MAP_FROM_QUADLET_BIT( value, bit, on, off ) ( US_BITS_IS_BITVALUE_SET(value,US_BITS_QUADLET_BIT(bit)) ? (on) : (off))
#define US_BITS_MAP_FROM_SEXLET_BIT( value, bit, on, off ) ( US_BITS_IS_BITVALUE_SET(value,US_BITS_SEXLET_BIT(bit)) ? (on) : (off))
#define US_BITS_MAP_FROM_OCTLET_BIT( value, bit, on, off ) ( US_BITS_IS_BITVALUE_SET(value,US_BITS_OCTLET_BIT(bit)) ? (on) : (off))

#define US_BITS_IS_OCTET_BIT_SET( value, bit ) US_BITS_IS_BITVALUE_SET(value,US_BITS_OCTET_BIT(bit))
#define US_BITS_IS_DOUBLET_BIT_SET( value, bit ) US_BITS_IS_BITVALUE_SET(value,US_BITS_DOUBLET_BIT(bit))
#define US_BITS_IS_QUADLET_BIT_SET( value, bit ) US_BITS_IS_BITVALUE_SET(value,US_BITS_QUADLET_BIT(bit))
#define US_BITS_IS_SEXLET_BIT_SET( value, bit ) US_BITS_IS_BITVALUE_SET(value,US_BITS_SEXLET_BIT(bit))
#define US_BITS_IS_OCTLET_BIT_SET( value, bit ) US_BITS_IS_BITVALUE_SET(value,US_BITS_OCTLET_BIT(bit))

#define US_BITS_IS_OCTET_BIT_CLEAR( value, bit ) US_BITS_IS_BITVALUE_CLEAR(value,US_BITS_OCTET_BIT(bit))
#define US_BITS_IS_DOUBLET_BIT_CLEAR( value, bit ) US_BITS_IS_BITVALUE_CLEAR(value,US_BITS_DOUBLET_BIT(bit))
#define US_BITS_IS_QUADLET_BIT_CLEAR( value, bit ) US_BITS_IS_BITVALUE_CLEAR(value,US_BITS_QUADLET_BIT(bit))
#define US_BITS_IS_SEXLET_BIT_CLEAR( value, bit ) US_BITS_IS_BITVALUE_CLEAR(value,US_BITS_SEXLET_BIT(bit))
#define US_BITS_IS_OCTLET_BIT_CLEAR( value, bit ) US_BITS_IS_BITVALUE_CLEAR(value,US_BITS_OCTLET_BIT(bit))

#define US_BITS_GET_OCTET_BIT( value, bit ) US_BITS_IS_OCTET_BIT_SET( (value), (bit) )
#define US_BITS_GET_DOUBLET_BIT( value, bit ) US_BITS_IS_DOUBLET_BIT_SET( (value), (bit) )
#define US_BITS_GET_QUADLET_BIT( value, bit ) US_BITS_IS_QUADLET_BIT_SET( (value), (bit) )
#define US_BITS_GET_SEXLET_BIT( value, bit ) US_BITS_IS_SEXLET_BIT_SET( (value), (bit) )
#define US_BITS_GET_OCTLET_BIT( value, bit ) US_BITS_IS_OCTLET_BIT_SET( (value), (bit) )

#define US_BITS_SET_OCTET_BIT( val, bit )  ((val) | US_BITS_OCTET_BIT(bit))
#define US_BITS_SET_DOUBLET_BIT( val, bit )  ((val) | US_BITS_DOUBLET_BIT(bit))
#define US_BITS_SET_QUADLET_BIT( val, bit )  ((val) | US_BITS_QUADLET_BIT(bit))
#define US_BITS_SET_SEXLET_BIT( val, bit )  ((val) | US_BITS_SEXLET_BIT(bit))
#define US_BITS_SET_OCTLET_BIT( val, bit )  ((val) | US_BITS_OCTLET_BIT(bit))

#define US_BITS_CLEAR_OCTET_BIT( val, bit ) ((val) & US_BITS_OCTET_MASK_BIT(bit))
#define US_BITS_CLEAR_DOUBLET_BIT( val, bit ) ((val) & US_BITS_DOUBLET_MASK_BIT(bit))
#define US_BITS_CLEAR_QUADLET_BIT( val, bit ) ((val) & US_BITS_QUADLET_MASK_BIT(bit))
#define US_BITS_CLEAR_SEXLET_BIT( val, bit ) ((val) & US_BITS_SEXLET_MASK_BIT(bit))
#define US_BITS_CLEAR_OCTLET_BIT( val, bit ) ((val) & US_BITS_OCTLET_MASK_BIT(bit))

#define US_BITS_SET_OCTET_BIT_IF( val, bit, query )  ((query) ? US_BITS_SET_OCTET_BIT(val,bit) : US_BITS_CLEAR_OCTET_BIT(val,bit))
#define US_BITS_SET_DOUBLET_BIT_IF( val, bit, query )  ((query) ? US_BITS_SET_DOUBLET_BIT(val,bit) : US_BITS_CLEAR_DOUBLET_BIT(val,bit))
#define US_BITS_SET_QUADLET_BIT_IF( val, bit, query )  ((query) ? US_BITS_SET_QUADLET_BIT(val,bit) : US_BITS_CLEAR_QUADLET_BIT(val,bit))
#define US_BITS_SET_SEXLET_BIT_IF( val, bit, query )  ((query) ? US_BITS_SET_SEXLET_BIT(val,bit) : US_BITS_CLEAR_SEXLET_BIT(val,bit))
#define US_BITS_SET_OCTLET_BIT_IF( val, bit, query )  ((query) ? US_BITS_SET_OCTLET_BIT(val,bit) : US_BITS_CLEAR_OCTLET_BIT(val,bit))

#define US_BITS_CLEAR_OCTET_BIT_IF( val, bit, query )  ((!query) ? US_BITS_SET_OCTET_BIT(val,bit) : US_BITS_CLEAR_OCTET_BIT(val,bit))
#define US_BITS_CLEAR_DOUBLET_BIT_IF( val, bit, query )  ((!query) ? US_BITS_SET_DOUBLET_BIT(val,bit) : US_BITS_CLEAR_DOUBLET_BIT(val,bit))
#define US_BITS_CLEAR_QUADLET_BIT_IF( val, bit, query )  ((!query) ? US_BITS_SET_QUADLET_BIT(val,bit) : US_BITS_CLEAR_QUADLET_BIT(val,bit))
#define US_BITS_CLEAR_SEXLET_BIT_IF( val, bit, query )  ((!query) ? US_BITS_SET_SEXLET_BIT(val,bit) : US_BITS_CLEAR_SEXLET_BIT(val,bit))
#define US_BITS_CLEAR_OCTLET_BIT_IF( val, bit, query )  ((!query) ? US_BITS_SET_OCTLET_BIT(val,bit) : US_BITS_CLEAR_OCTLET_BIT(val,bit))


    /*@}*/

    /** \addtogtoup bitfield bitfield utility functions. bit is IEEE style bit number of the lsb of the field */

    /*@{*/

#define US_BITS_OCTET_BITFIELD(bit,width) (((0xff)>>(8-(width)))<<(7-(bit)))
#define US_BITS_DOUBLET_BITFIELD(bit,width) (((0xffff)>>(16-(width)))<<(15-(bit)))
#define US_BITS_QUADLET_BITFIELD(bit,width) (((0xffffffff)>>(32-(width)))<<(31-(bit)))
#define US_BITS_SEXLET_BITFIELD(bit,width) (((0xffffffffffff)>>(48-(width)))<<(47-(bit)))
#define US_BITS_OCTLET_BITFIELD(bit,width) (((0xffffffffffffffff)>>(64-(width)))<<(63-(bit)))

#define US_BITS_OCTET_MASK_BITFIELD(bit,width) ((~US_BITS_OCTET_BITFIELD((bit),(width)))&0xff)
#define US_BITS_DOUBLET_MASK_BITFIELD(bit,width) ((~US_BITS_DOUBLET_BITFIELD((bit),(width)))&0xffff)
#define US_BITS_QUADLET_MASK_BITFIELD(bit,width) ((~US_BITS_QUADLET_BITFIELD((bit),(width)))&0xffffffff)
#define US_BITS_SEXLET_MASK_BITFIELD(bit,width) ((~US_BITS_SEXLET_BITFIELD((bit),(width)))&0xffffffffffff)
#define US_BITS_OCTLET_MASK_BITFIELD(bit,width) ((~US_BITS_OCTLET_BITFIELD((bit),(width)))&0xffffffffffffffff)

#define US_BITS_GET_OCTET_BITFIELD_W(val,bit,width)  (((val) & US_BITS_OCTET_BITFIELD(bit,width)) >> (7-(bit)))
#define US_BITS_GET_DOUBLET_BITFIELD_W(val,bit,width)  (((val) & US_BITS_DOUBLET_BITFIELD(bit,width)) >> (15-(bit)))
#define US_BITS_GET_QUADLET_BITFIELD_W(val,bit,width)  (((val) & US_BITS_QUADLET_BITFIELD(bit,width)) >> (31-(bit)))
#define US_BITS_GET_SEXLET_BITFIELD_W(val,bit,width)  (((val) & US_BITS_SEXLET_BITFIELD(bit,width)) >> (47-(bit)))
#define US_BITS_GET_OCTLET_BITFIELD_W(val,bit,width)  (((val) & US_BITS_OCTLET_BITFIELD(bit,width)) >> (63-(bit)))

#define US_BITS_SET_OCTET_BITFIELD_W(val,bit,width,fieldval) (((fieldval)<<(7-(bit))) | ((val) & US_BITS_OCTET_MASK_BITFIELD((bit),(width))))
#define US_BITS_SET_DOUBLET_BITFIELD_W(val,bit,width,fieldval) (((fieldval)<<(15-(bit))) | ((val) & US_BITS_DOUBLET_MASK_BITFIELD((bit),(width))))
#define US_BITS_SET_QUADLET_BITFIELD_W(val,bit,width,fieldval) (((fieldval)<<(31-(bit))) | ((val) & US_BITS_QUADLET_MASK_BITFIELD((bit),(width))))
#define US_BITS_SET_SEXLET_BITFIELD_W(val,bit,width,fieldval) (((fieldval)<<(47-(bit))) | ((val) & US_BITS_SEXLET_MASK_BITFIELD((bit),(width))))<commit_msg>fixed missing ULL for unsigned long longs<commit_after>#ifndef US_BITS_H
#define US_BITS_H

/*
Copyright (c) 2011, Meyer Sound Laboratories, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of the Meyer Sound Laboratories, Inc. nor the
      names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL MEYER SOUND LABORATORIES, INC. BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef US_WORLD_H
#include "us_world.h"
#endif

#define US_BITS_GET_OCTET_0 US_GET_BYTE_0
#define US_BITS_GET_OCTET_1 US_GET_BYTE_1
#define US_BITS_GET_OCTET_2 US_GET_BYTE_2
#define US_BITS_GET_OCTET_3 US_GET_BYTE_3
#define US_BITS_GET_OCTET_4 US_GET_BYTE_4
#define US_BITS_GET_OCTET_5 US_GET_BYTE_5
#define US_BITS_GET_OCTET_6 US_GET_BYTE_6
#define US_BITS_GET_OCTET_7 US_GET_BYTE_7

#define US_BITS_MAKE_DOUBLET( b1, b0 ) \
( (((uint16_t)(b1))<<8) | (((uint16_t)(b0))<<0) )

#define US_BITS_MAKE_QUADLET( b3, b2, b1, b0 ) \
( (((uint32_t)(b3))<<24) | (((uint32_t)(b2))<<16) | (((uint32_t)(b1))<<8) | (((uint32_t)(b0))<<0) )

#define US_BITS_MAKE_SEXLET( b5, b4, b3, b2, b1, b0 ) \
(((uint64_t)US_BITS_MAKE_QUADLET( 0, 0, (b5), (b4) )<<32) | ((uint64_t)US_BITS_MAKE_QUADLET((b3),(b2),(b1),(b0))))

#define US_BITS_MAKE_OCTLET( b7, b6, b5, b4, b3, b2, b1, b0 ) \
(((uint64_t)US_BITS_MAKE_QUADLET( (b7), (b6), (b5), (b4) )<<32) | ((uint64_t)US_BITS_MAKE_QUADLET((b3),(b2),(b1),(b0))))


/**
 \addtogroup us_bits IEEE bit packing utilities
 */

/*@{*/

#ifdef __cplusplus
extern "C"
{
#endif



    /** \addtogtoup bit_util bit utilities */

    /*@{*/

#define US_BITS_OCTET_BIT(bit) (((uint8_t)0x80)>>(bit))
#define US_BITS_DOUBLET_BIT(bit) (((uint16_t)0x8000)>>(bit))
#define US_BITS_QUADLET_BIT(bit) (((uint32_t)0x80000000ULL)>>(bit))
#define US_BITS_SEXLET_BIT(bit) (((uint64_t)0x800000000000ULL)>>(bit))
#define US_BITS_OCTLET_BIT(bit) (((uint64_t)0x8000000000000000ULL)>>(bit))

#define US_BITS_OCTET_MASK_BIT(bit) ((~US_BITS_OCTET_BIT(bit))&0xff)
#define US_BITS_DOUBLET_MASK_BIT(bit) ((~US_BITS_DOUBLET_BIT(bit))&0xffff)
#define US_BITS_QUADLET_MASK_BIT(bit) ((~US_BITS_QUADLET_BIT(bit))&0xffffffffULL)
#define US_BITS_SEXLET_MASK_BIT(bit) ((~US_BITS_SEXLET_BIT(bit))&0xffffffffffffULL)
#define US_BITS_OCTLET_MASK_BIT(bit) ((~US_BITS_OCTLET_BIT(bit))&0xffffffffffffffffULL)

#define US_BITS_IS_BITVALUE_SET( value, bit_value ) (((value)&(bit_value))!=0)
#define US_BITS_IS_BITVALUE_CLEAR( value, bit_value ) (((value)&(bit_value))==0)

#define US_BITS_MAP_FROM_OCTET_BIT( value, bit, on, off ) ( US_BITS_IS_BITVALUE_SET(value,US_BITS_OCTET_BIT(bit)) ? (on) : (off))
#define US_BITS_MAP_FROM_DOUBLET_BIT( value, bit, on, off ) ( US_BITS_IS_BITVALUE_SET(value,US_BITS_DOUBLET_BIT(bit)) ? (on) : (off))
#define US_BITS_MAP_FROM_QUADLET_BIT( value, bit, on, off ) ( US_BITS_IS_BITVALUE_SET(value,US_BITS_QUADLET_BIT(bit)) ? (on) : (off))
#define US_BITS_MAP_FROM_SEXLET_BIT( value, bit, on, off ) ( US_BITS_IS_BITVALUE_SET(value,US_BITS_SEXLET_BIT(bit)) ? (on) : (off))
#define US_BITS_MAP_FROM_OCTLET_BIT( value, bit, on, off ) ( US_BITS_IS_BITVALUE_SET(value,US_BITS_OCTLET_BIT(bit)) ? (on) : (off))

#define US_BITS_IS_OCTET_BIT_SET( value, bit ) US_BITS_IS_BITVALUE_SET(value,US_BITS_OCTET_BIT(bit))
#define US_BITS_IS_DOUBLET_BIT_SET( value, bit ) US_BITS_IS_BITVALUE_SET(value,US_BITS_DOUBLET_BIT(bit))
#define US_BITS_IS_QUADLET_BIT_SET( value, bit ) US_BITS_IS_BITVALUE_SET(value,US_BITS_QUADLET_BIT(bit))
#define US_BITS_IS_SEXLET_BIT_SET( value, bit ) US_BITS_IS_BITVALUE_SET(value,US_BITS_SEXLET_BIT(bit))
#define US_BITS_IS_OCTLET_BIT_SET( value, bit ) US_BITS_IS_BITVALUE_SET(value,US_BITS_OCTLET_BIT(bit))

#define US_BITS_IS_OCTET_BIT_CLEAR( value, bit ) US_BITS_IS_BITVALUE_CLEAR(value,US_BITS_OCTET_BIT(bit))
#define US_BITS_IS_DOUBLET_BIT_CLEAR( value, bit ) US_BITS_IS_BITVALUE_CLEAR(value,US_BITS_DOUBLET_BIT(bit))
#define US_BITS_IS_QUADLET_BIT_CLEAR( value, bit ) US_BITS_IS_BITVALUE_CLEAR(value,US_BITS_QUADLET_BIT(bit))
#define US_BITS_IS_SEXLET_BIT_CLEAR( value, bit ) US_BITS_IS_BITVALUE_CLEAR(value,US_BITS_SEXLET_BIT(bit))
#define US_BITS_IS_OCTLET_BIT_CLEAR( value, bit ) US_BITS_IS_BITVALUE_CLEAR(value,US_BITS_OCTLET_BIT(bit))

#define US_BITS_GET_OCTET_BIT( value, bit ) US_BITS_IS_OCTET_BIT_SET( (value), (bit) )
#define US_BITS_GET_DOUBLET_BIT( value, bit ) US_BITS_IS_DOUBLET_BIT_SET( (value), (bit) )
#define US_BITS_GET_QUADLET_BIT( value, bit ) US_BITS_IS_QUADLET_BIT_SET( (value), (bit) )
#define US_BITS_GET_SEXLET_BIT( value, bit ) US_BITS_IS_SEXLET_BIT_SET( (value), (bit) )
#define US_BITS_GET_OCTLET_BIT( value, bit ) US_BITS_IS_OCTLET_BIT_SET( (value), (bit) )

#define US_BITS_SET_OCTET_BIT( val, bit )  ((val) | US_BITS_OCTET_BIT(bit))
#define US_BITS_SET_DOUBLET_BIT( val, bit )  ((val) | US_BITS_DOUBLET_BIT(bit))
#define US_BITS_SET_QUADLET_BIT( val, bit )  ((val) | US_BITS_QUADLET_BIT(bit))
#define US_BITS_SET_SEXLET_BIT( val, bit )  ((val) | US_BITS_SEXLET_BIT(bit))
#define US_BITS_SET_OCTLET_BIT( val, bit )  ((val) | US_BITS_OCTLET_BIT(bit))

#define US_BITS_CLEAR_OCTET_BIT( val, bit ) ((val) & US_BITS_OCTET_MASK_BIT(bit))
#define US_BITS_CLEAR_DOUBLET_BIT( val, bit ) ((val) & US_BITS_DOUBLET_MASK_BIT(bit))
#define US_BITS_CLEAR_QUADLET_BIT( val, bit ) ((val) & US_BITS_QUADLET_MASK_BIT(bit))
#define US_BITS_CLEAR_SEXLET_BIT( val, bit ) ((val) & US_BITS_SEXLET_MASK_BIT(bit))
#define US_BITS_CLEAR_OCTLET_BIT( val, bit ) ((val) & US_BITS_OCTLET_MASK_BIT(bit))

#define US_BITS_SET_OCTET_BIT_IF( val, bit, query )  ((query) ? US_BITS_SET_OCTET_BIT(val,bit) : US_BITS_CLEAR_OCTET_BIT(val,bit))
#define US_BITS_SET_DOUBLET_BIT_IF( val, bit, query )  ((query) ? US_BITS_SET_DOUBLET_BIT(val,bit) : US_BITS_CLEAR_DOUBLET_BIT(val,bit))
#define US_BITS_SET_QUADLET_BIT_IF( val, bit, query )  ((query) ? US_BITS_SET_QUADLET_BIT(val,bit) : US_BITS_CLEAR_QUADLET_BIT(val,bit))
#define US_BITS_SET_SEXLET_BIT_IF( val, bit, query )  ((query) ? US_BITS_SET_SEXLET_BIT(val,bit) : US_BITS_CLEAR_SEXLET_BIT(val,bit))
#define US_BITS_SET_OCTLET_BIT_IF( val, bit, query )  ((query) ? US_BITS_SET_OCTLET_BIT(val,bit) : US_BITS_CLEAR_OCTLET_BIT(val,bit))

#define US_BITS_CLEAR_OCTET_BIT_IF( val, bit, query )  ((!query) ? US_BITS_SET_OCTET_BIT(val,bit) : US_BITS_CLEAR_OCTET_BIT(val,bit))
#define US_BITS_CLEAR_DOUBLET_BIT_IF( val, bit, query )  ((!query) ? US_BITS_SET_DOUBLET_BIT(val,bit) : US_BITS_CLEAR_DOUBLET_BIT(val,bit))
#define US_BITS_CLEAR_QUADLET_BIT_IF( val, bit, query )  ((!query) ? US_BITS_SET_QUADLET_BIT(val,bit) : US_BITS_CLEAR_QUADLET_BIT(val,bit))
#define US_BITS_CLEAR_SEXLET_BIT_IF( val, bit, query )  ((!query) ? US_BITS_SET_SEXLET_BIT(val,bit) : US_BITS_CLEAR_SEXLET_BIT(val,bit))
#define US_BITS_CLEAR_OCTLET_BIT_IF( val, bit, query )  ((!query) ? US_BITS_SET_OCTLET_BIT(val,bit) : US_BITS_CLEAR_OCTLET_BIT(val,bit))


    /*@}*/

    /** \addtogtoup bitfield bitfield utility functions. bit is IEEE style bit number of the lsb of the field */

    /*@{*/

#define US_BITS_OCTET_BITFIELD(bit,width) (((0xff)>>(8-(width)))<<(7-(bit)))
#define US_BITS_DOUBLET_BITFIELD(bit,width) (((0xffff)>>(16-(width)))<<(15-(bit)))
#define US_BITS_QUADLET_BITFIELD(bit,width) (((0xffffffff)>>(32-(width)))<<(31-(bit)))
#define US_BITS_SEXLET_BITFIELD(bit,width) (((0xffffffffffffULL)>>(48-(width)))<<(47-(bit)))
#define US_BITS_OCTLET_BITFIELD(bit,width) (((0xffffffffffffffffULL)>>(64-(width)))<<(63-(bit)))

#define US_BITS_OCTET_MASK_BITFIELD(bit,width) ((~US_BITS_OCTET_BITFIELD((bit),(width)))&0xff)
#define US_BITS_DOUBLET_MASK_BITFIELD(bit,width) ((~US_BITS_DOUBLET_BITFIELD((bit),(width)))&0xffff)
#define US_BITS_QUADLET_MASK_BITFIELD(bit,width) ((~US_BITS_QUADLET_BITFIELD((bit),(width)))&0xffffffff)
#define US_BITS_SEXLET_MASK_BITFIELD(bit,width) ((~US_BITS_SEXLET_BITFIELD((bit),(width)))&0xffffffffffffULL)
#define US_BITS_OCTLET_MASK_BITFIELD(bit,width) ((~US_BITS_OCTLET_BITFIELD((bit),(width)))&0xffffffffffffffffULL)

#define US_BITS_GET_OCTET_BITFIELD_W(val,bit,width)  (((val) & US_BITS_OCTET_BITFIELD(bit,width)) >> (7-(bit)))
#define US_BITS_GET_DOUBLET_BITFIELD_W(val,bit,width)  (((val) & US_BITS_DOUBLET_BITFIELD(bit,width)) >> (15-(bit)))
#define US_BITS_GET_QUADLET_BITFIELD_W(val,bit,width)  (((val) & US_BITS_QUADLET_BITFIELD(bit,width)) >> (31-(bit)))
#define US_BITS_GET_SEXLET_BITFIELD_W(val,bit,width)  (((val) & US_BITS_SEXLET_BITFIELD(bit,width)) >> (47-(bit)))
#define US_BITS_GET_OCTLET_BITFIELD_W(val,bit,width)  (((val) & US_BITS_OCTLET_BITFIELD(bit,width)) >> (63-(bit)))

#define US_BITS_SET_OCTET_BITFIELD_W(val,bit,width,fieldval) (((fieldval)<<(7-(bit))) | ((val) & US_BITS_OCTET_MASK_BITFIELD((bit),(width))))
#define US_BITS_SET_DOUBLET_BITFIELD_W(val,bit,width,fieldval) (((fieldval)<<(15-(bit))) | ((val) & US_BITS_DOUBLET_MASK_BITFIELD((bit),(width))))
#define US_BITS_SET_QUADLET_BITFIELD_W(val,bit,width,fieldval) (((fieldval)<<(31-(bit))) | ((val) & US_BITS_QUADLET_MASK_BITFIELD((bit),(width))))
#define US_BITS_SET_SEXLET_BITFIELD_W(val,bit,width,fieldval) (((fieldval)<<(47-(bit))) | ((val) & US_BITS_SEXLET_MASK_BITFIELD((bit),(width))))
{'fraction_non_alphanumeric': 0.13743060290250317, 'fraction_numerical': 0.01957728645173858, 'mean_word_length': 8.839482510781025, 'pattern_counts': {'":': 0, '<': 71, '<?xml version=': 0, '>': 63, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 24, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3694922', 'n_tokens_mistral': 8737, 'n_tokens_neox': 8328, 'n_words': 1449}