diff --git a/src/g5dec.inl b/src/g5dec.inl index 07ebd52..76254b4 100644 --- a/src/g5dec.inl +++ b/src/g5dec.inl @@ -138,11 +138,19 @@ static void Decode_Begin(G5DECIMAGE *pPage) pPage->ulBits = TIFFMOTOLONG(pPage->pSrc); // load 32 bits to start pPage->ulBitOff = 0; // Calculate the number of bits needed for a long horizontal code +#ifdef __GNUC__ #ifdef __AVR__ pPage->iHLen = 16 - __builtin_clz(pPage->iWidth); #else pPage->iHLen = 32 - __builtin_clz(pPage->iWidth); #endif +#else +#ifdef _MSC_VER + pPage->iHLen = 32 - __lzcnt(pPage->iWidth); +#else + #error "Unsupported compiler for G5 decoder" +#endif // _MSC_VER +#endif } /* Decode_Begin() */ // // Decode a single line of G5 data (private function)