diff options
| author | Ludovic Arnaud <ludovic_arnaud@users.sourceforge.net> | 2003-07-02 22:23:45 +0000 |
|---|---|---|
| committer | Ludovic Arnaud <ludovic_arnaud@users.sourceforge.net> | 2003-07-02 22:23:45 +0000 |
| commit | b59698aa102b6e6c3d86cb4ec875386e4b9018a7 (patch) | |
| tree | 93c8baa457f7b626d5fcb632e9329d395a1204ac /phpBB/includes/bbcode.php | |
| parent | 03d46951b2265ea53269810c6c7e421441a2be09 (diff) | |
| download | forums-b59698aa102b6e6c3d86cb4ec875386e4b9018a7.tar forums-b59698aa102b6e6c3d86cb4ec875386e4b9018a7.tar.gz forums-b59698aa102b6e6c3d86cb4ec875386e4b9018a7.tar.bz2 forums-b59698aa102b6e6c3d86cb4ec875386e4b9018a7.tar.xz forums-b59698aa102b6e6c3d86cb4ec875386e4b9018a7.zip | |
Shifting bits appears to be faster than the pow() function
git-svn-id: file:///svn/phpbb/trunk@4190 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/bbcode.php')
| -rw-r--r-- | phpBB/includes/bbcode.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 318a495858..18b5e961a7 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -35,18 +35,18 @@ class bbcode } } - function bbcode_second_pass(&$message, $bbcode_uid = '', $bbcode_bitfield = '') + function bbcode_second_pass(&$message, $bbcode_uid = '', $bbcode_bitfield = FALSE) { if ($bbcode_uid) { $this->bbcode_uid = $bbcode_uid; } - if ($bbcode_bitfield) + if ($bbcode_bitfield !== FALSE) { $this->bbcode_bitfield = $bbcode_bitfield; } - elseif (!$this->bbcode_bitfield) + if (!$this->bbcode_bitfield) { return $message; } @@ -62,7 +62,7 @@ class bbcode $bitlen = strlen(decbin($this->bbcode_bitfield)); for ($bbcode_id = 0; $bbcode_id < $bitlen; ++$bbcode_id) { - if ($this->bbcode_bitfield & pow(2, $bbcode_id)) + if ($this->bbcode_bitfield & (1 << $bbcode_id)) { foreach ($this->bbcode_cache[$bbcode_id] as $type => $array) { @@ -105,7 +105,7 @@ class bbcode for ($bbcode_id = 0; $bbcode_id < $bitlen; ++$bbcode_id) { - if (isset($this->bbcode_cache[$bbcode_id]) || !($this->bbcode_bitfield & pow(2, $bbcode_id))) + if (isset($this->bbcode_cache[$bbcode_id]) || !($this->bbcode_bitfield & (1 << $bbcode_id))) { // do not try to re-cache it if it's already in continue; @@ -276,7 +276,7 @@ class bbcode ); } - if ($bbcode_id != -1 && !($user->theme['bbcode_bitfield'] & pow(2, $bbcode_id))) + if ($bbcode_id != -1 && !($user->theme['bbcode_bitfield'] & (1 << $bbcode_id))) { return $bbcode_hardtpl[$tpl_name]; } |
