UnityPyBoost/AnimationClip.c
// TODO: check if bitPos, bits, and num can be reduced to chars
check if bitPos, bits, and num can be reduced to chars
check if bitPos bits and num can be reduced to chars
static int *UnpackInts(uint32_t m_NumItems, uint8_t *m_Data, char m_BitSize)
{
    int *data = (int *)malloc(m_NumItems * sizeof(int));
    int indexPos = 0;
    int bitPos = 0;
    for (uint32_t i = 0; i < m_NumItems; i++)
    {
        int bits = 0;
        data[i] = 0;
        while (bits < m_BitSize)
        {
            data[i] |= (m_Data[indexPos] >> bitPos) << bits;
            int num = MIN(m_BitSize - bits, 8 - bitPos);
            bitPos += num;
            bits += num;
            if (bitPos == 8)
            {
                indexPos++;
                bitPos = 0;
            }
        }
        data[i] &= (1 << m_BitSize) - 1;
    }
    return data;
}
static int * UnpackInts ( uint32_t m_NumItems , uint8_t * m_Data , char m_BitSize ) { int * data = ( int * ) malloc ( m_NumItems * sizeof ( int ) ) ; int indexPos = 0 ; int bitPos = 0 ; for ( uint32_t i = 0 ; i < m_NumItems ; i ++ ) { int bits = 0 ; data [ i ] = 0 ; while ( bits < m_BitSize ) { data [ i ] |= ( m_Data [ indexPos ] >> bitPos ) << bits ; int num = MIN ( m_BitSize - bits , 8 - bitPos ) ; bitPos += num ; bits += num ; if ( bitPos == 8 ) { indexPos ++ ; bitPos = 0 ; } } data [ i ] &= ( 1 << m_BitSize ) - 1 ; } return data ; }
TODO: check if bitPos, bits, and num can be reduced to chars
TODO : check if bitPos bits and num can be reduced to chars