Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix error for 32bit systems #54

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions lib/bx/interval_index_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
"""

import os.path
import sys
from bisect import (
insort,
insort_right,
Expand Down Expand Up @@ -124,7 +123,7 @@
BIN_OFFSETS_MAX.insert(0, (BIN_OFFSETS_MAX[0] << BIN_NEXT_SHIFT))
# The maximum size for the top bin is actually bigger than the signed integers
# we use to store positions in the file, so we'll change it to prevent confusion
BIN_OFFSETS_MAX[0] = sys.maxsize
BIN_OFFSETS_MAX[0] = 2**63

# Constants for the minimum and maximum size of the overall interval
MIN = 0
Expand All @@ -137,12 +136,14 @@ def offsets_for_max_size(max_size):
"""
Return the subset of offsets needed to contain intervals over (0,max_size)
"""
for i, max in enumerate(reversed(BIN_OFFSETS_MAX)):
if max_size < max:
offset_index = None
for i, off_max in enumerate(reversed(BIN_OFFSETS_MAX)):
if max_size <= off_max:
offset_index = i
break
else:
if offset_index is None:
raise Exception("%d is larger than the maximum possible size (%d)" % (max_size, BIN_OFFSETS_MAX[0]))
return BIN_OFFSETS[(len(BIN_OFFSETS) - i - 1) :]
return BIN_OFFSETS[(len(BIN_OFFSETS) - offset_index - 1):]


def bin_for_range(start, end, offsets=None):
Expand Down
Loading