Reading data at 10 Khz rate

Ok this code is most efficient so far once it goes out of Sync in 2-3 iteration it comes back but they are saying make it like sliding window and you keep on sliding 1 bit at a time until you found the match("CAAC1F") and when found send it reaming bits(128-24=104) and again start the process. Can it be done?
Thanks and Regards
Niladri