Re: Re: crc32() improvements
| From: | Alexander Valyalkin | Date: | Mon, 14 Jun 2004 10:17:46 +0000 |
| Subject: | Re: Re: crc32() improvements | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-10433@lists.php.net to get a copy of this message | ||
On Mon, 14 Jun 2004 11:00:33 +0200 (CEST), Derick Rethans <derick@php.net> wrote:
:) Are you sure? I'm not. Look on declaration of [nr] variable: int nr; And answer, please, which value will be assigned to nr, if length of a string will be greater than 0x7fffffff on 32-bit architecture?Of course not, that's pointless as a string can never have a negative length.if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &p, &nr) ==FAILURE) {return; } /* !!! there is no error check nr < 0 */
I can't find any sense of the [len] variable. Can you?Why? It's used one line below and you HAVE to initalize a variable.len = 0 ; /* !!! remove it! */
It is only idle talk. Can you provide any string from my code which violates your "coding standards"? By the way, your "coding standards" violates C standards on type of string (and any other byte arrays) length. Why are you use int instead of size_t?: typedef union _zvalue_value {Below is corrected function with speed improvement in main cycleIt also violates our coding standards BIG time.
long lval; /* long value */
double dval; /* double value */
struct {
char *val;
int len; /* !!!!!!!!!!!!! why int, not size_t ????? */
} str;
HashTable *ht; /* hash table value */
zend_object obj;
} zvalue_value;
And there is no reason to expand that macro at allIs significant speed improvement silly reason for you? -- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/