Use the DB wrapper of Drupal for bitwise.