12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #include "php.h"
- #include "basic_functions.h"
- #include "crc32.h"
- PHP_NAMED_FUNCTION(php_if_crc32)
- {
- char *p;
- size_t nr;
- uint32_t crcinit = 0;
- register uint32_t crc;
- ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_STRING(p, nr)
- ZEND_PARSE_PARAMETERS_END();
- crc = crcinit^0xFFFFFFFF;
- for (; nr--; ++p) {
- crc = ((crc >> 8) & 0x00FFFFFF) ^ crc32tab[(crc ^ (*p)) & 0xFF ];
- }
- RETVAL_LONG(crc^0xFFFFFFFF);
- }
|