function _openid_get_math_library

7.x openid.inc _openid_get_math_library()

Determine the available math library GMP vs. BCMath, favouring GMP for performance.

8 calls to _openid_get_math_library()
openid_begin in drupal-7.x/modules/openid/openid.module
The initial step of OpenID authentication responsible for the following:
_openid_math_add in drupal-7.x/modules/openid/openid.inc
Calls the add function from the available math library for OpenID.
_openid_math_cmp in drupal-7.x/modules/openid/openid.inc
Calls the cmp function from the available math library for OpenID.
_openid_math_div in drupal-7.x/modules/openid/openid.inc
Calls the div function from the available math library for OpenID.
_openid_math_mod in drupal-7.x/modules/openid/openid.inc
Calls the mod function from the available math library for OpenID.

... See full list

File

drupal-7.x/modules/openid/openid.inc, line 714
OpenID utility functions.

Code

function _openid_get_math_library() {
  // Not drupal_static(), because a function is not going to disappear and
  // change the output of this under any circumstances.
  static $library;

  if (empty($library)) {
    if (function_exists('gmp_add')) {
      $library = 'gmp';
    }
    elseif (function_exists('bcadd')) {
      $library = 'bcmath';
    }
  }

  return $library;
}