Bitmap related algoritms