external/the-forge/Common_3/ThirdParty/OpenSource/soloud20181119/src/audiosource/wav/dr_flac.h
static drflac_bool32 drflac__find_and_seek_to_next_sync_code(drflac_bs* bs)
{
    drflac_assert(bs != NULL);

    // The sync code is always aligned to 8 bits. This is convenient for us because it means we can do byte-aligned movements. The first
    // thing to do is align to the next byte.
    if (!drflac__seek_bits(bs, DRFLAC_CACHE_L1_BITS_REMAINING(bs) & 7)) {
        return DRFLAC_FALSE;
    }

    for (;;) {
#ifndef DR_FLAC_NO_CRC
        drflac__reset_crc16(bs);
#endif

        drflac_uint8 hi;
        if (!drflac__read_uint8(bs, 8, &hi)) {
            return DRFLAC_FALSE;
        }

        if (hi == 0xFF) {
            drflac_uint8 lo;
            if (!drflac__read_uint8(bs, 6, &lo)) {
                return DRFLAC_FALSE;
            }

            if (lo == 0x3E) {
                return DRFLAC_TRUE;
            } else {
                if (!drflac__seek_bits(bs, DRFLAC_CACHE_L1_BITS_REMAINING(bs) & 7)) {
                    return DRFLAC_FALSE;
                }
            }
        }
    }

    // Should never get here.
    //return DRFLAC_FALSE;
}
// This function moves the bit streamer to the first bit after the sync code (bit 15 of the of the frame header). It will also update the CRC-16.
This function moves the bit streamer to the first bit after the sync code (bit 15 of the of the frame header). It will also update the CRC-16.
This function moves the bit streamer to the first bit after the sync code ( bit 15 of the of the frame header ) . It will also update the CRC - 16 .
static drflac_bool32 drflac__find_and_seek_to_next_sync_code(drflac_bs* bs)
{
    drflac_assert(bs != NULL);
    if (!drflac__seek_bits(bs, DRFLAC_CACHE_L1_BITS_REMAINING(bs) & 7)) {
        return DRFLAC_FALSE;
    }
    for (;;) {
#ifndef DR_FLAC_NO_CRC
        drflac__reset_crc16(bs);
#endif
        drflac_uint8 hi;
        if (!drflac__read_uint8(bs, 8, &hi)) {
            return DRFLAC_FALSE;
        }
        if (hi == 0xFF) {
            drflac_uint8 lo;
            if (!drflac__read_uint8(bs, 6, &lo)) {
                return DRFLAC_FALSE;
            }
            if (lo == 0x3E) {
                return DRFLAC_TRUE;
            } else {
                if (!drflac__seek_bits(bs, DRFLAC_CACHE_L1_BITS_REMAINING(bs) & 7)) {
                    return DRFLAC_FALSE;
                }
            }
        }
    }
}
static drflac_bool32 drflac__find_and_seek_to_next_sync_code ( drflac_bs * bs ) { drflac_assert ( bs != NULL ) ; if ( ! drflac__seek_bits ( bs , DRFLAC_CACHE_L1_BITS_REMAINING ( bs ) & 7 ) ) { return DRFLAC_FALSE ; } for ( ; ; ) { #ifndef DR_FLAC_NO_CRC drflac__reset_crc16 ( bs ) ; #endif drflac_uint8 hi ; if ( ! drflac__read_uint8 ( bs , 8 , & hi ) ) { return DRFLAC_FALSE ; } if ( hi == 0xFF ) { drflac_uint8 lo ; if ( ! drflac__read_uint8 ( bs , 6 , & lo ) ) { return DRFLAC_FALSE ; } if ( lo == 0x3E ) { return DRFLAC_TRUE ; } else { if ( ! drflac__seek_bits ( bs , DRFLAC_CACHE_L1_BITS_REMAINING ( bs ) & 7 ) ) { return DRFLAC_FALSE ; } } } } }
This function moves the bit streamer to the first bit after the sync code (bit 15 of the of the frame header).
This function moves the bit streamer to the first bit after the sync code ( bit 15 of the of the frame header ) .
// The sync code is always aligned to 8 bits. This is convenient for us because it means we can do byte-aligned movements. The first // thing to do is align to the next byte. // Should never get here. //return DRFLAC_FALSE;