On Tue, 11 Aug 2009, Szak�ts Viktor wrote: >> Maybe we should add to RTL set of functions to swap bytes in numbers? >> I.e. hb_swapI(), hb_swapW(), hb_swapL(), hb_swapU(), hb_swapLL() >> The suffixes should correspond to BIN2?() functions but maybe you have >> better proposition for names. >> With such function tp_crc16() can be implemented as: >> FUNCTION tp_crc16( cString ) >> RETURN hb_swapW( hb_crcct( cString ) ) >> What do you think? > I agree, can be useful. Maybe HB_BINSWAP*() would be a less > generic name. It would also align with BIN2*() naming.
BIN in Clipper means binary representation so such name suggests that argument is character string with result of *2BIN() function. IMHO it should be rather NUM, i.e. HB_NUMSWAP*(). > The other question is what to expect from HB_BINSWAPL[L]()? Would it > swap the two halves or would it reverse the bytes? I thought about bytes swaping just like in __builtin_bswap*() GCC functions. So maybe we should call it HB_BYTESWAP*()? best regards, Przemek _______________________________________________ Harbour mailing list [email protected] http://lists.harbour-project.org/mailman/listinfo/harbour
