moriyoshi               Fri Jan 17 04:04:03 2003 EDT

  Modified files:              
    /php4/ext/standard  filters.c 
  Log:
  Significant speed enhancements. I was underestimating the power of recent
  CPUs :)
  
  
Index: php4/ext/standard/filters.c
diff -u php4/ext/standard/filters.c:1.20 php4/ext/standard/filters.c:1.21
--- php4/ext/standard/filters.c:1.20    Thu Jan 16 15:59:07 2003
+++ php4/ext/standard/filters.c Fri Jan 17 04:04:02 2003
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: filters.c,v 1.20 2003/01/16 20:59:07 moriyoshi Exp $ */
+/* $Id: filters.c,v 1.21 2003/01/17 09:04:02 moriyoshi Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -533,6 +533,7 @@
        /* do nothing */
 }
 
+#define bmask(a) (0xffff >> (16 - a))
 static php_conv_err_t php_conv_base64_decode_convert(php_conv_base64_decode *inst, 
const char **in_pp, size_t *in_left_p, char **out_pp, size_t *out_left_p)
 {
        php_conv_err_t err;
@@ -545,12 +546,6 @@
 
        const static unsigned int nbitsof_pack = 8;
 
-       static unsigned int bmask[17] = {
-               0x0000, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f,
-               0x00ff, 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff,
-               0xffff
-       };
-
        if (in_pp == NULL || in_left_p == NULL) {
                if (inst->eos || inst->urem_nbits == 0) { 
                        return SUCCESS;
@@ -580,7 +575,7 @@
                } else {
                        urem_nbits -= pack_bcnt;
                        pack |= (urem >> urem_nbits);
-                       urem &= bmask[urem_nbits];
+                       urem &= bmask(urem_nbits);
                        pack_bcnt = 0;
                }
                if (pack_bcnt > 0) {
@@ -606,7 +601,7 @@
                                } else {
                                        urem_nbits = 6 - pack_bcnt;
                                        pack |= (i >> urem_nbits);
-                                       urem = i & bmask[urem_nbits];
+                                       urem = i & bmask(urem_nbits);
                                        pack_bcnt = 0;
                                }
                        } else if (ustat) {
@@ -648,6 +643,7 @@
 
        return err;
 }
+#undef bmask
 /* }}} */
 
 /* {{{ php_conv_qprint_encode */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to