##// END OF EJS Templates
sparse-revlog: add a `index_segment_span` function in C...
Boris Feld -
r40741:4ec6a240 default
parent child Browse files
Show More
@@ -1050,6 +1050,34 b' bail:'
1050 return NULL;
1050 return NULL;
1051 }
1051 }
1052
1052
1053 static inline int64_t
1054 index_segment_span(indexObject *self, Py_ssize_t start_rev, Py_ssize_t end_rev)
1055 {
1056 int64_t start_offset;
1057 int64_t end_offset;
1058 int end_size;
1059 start_offset = index_get_start(self, start_rev);
1060 if (start_offset < 0) {
1061 return -1;
1062 }
1063 end_offset = index_get_start(self, end_rev);
1064 if (end_offset < 0) {
1065 return -1;
1066 }
1067 end_size = index_get_length(self, end_rev);
1068 if (end_size < 0) {
1069 return -1;
1070 }
1071 if (end_offset < start_offset) {
1072 PyErr_Format(PyExc_ValueError,
1073 "corrupted revlog index: inconsistent offset "
1074 "between revisions (%zd) and (%zd)",
1075 start_rev, end_rev);
1076 return -1;
1077 }
1078 return (end_offset - start_offset) + (int64_t)end_size;
1079 }
1080
1053 static inline int nt_level(const char *node, Py_ssize_t level)
1081 static inline int nt_level(const char *node, Py_ssize_t level)
1054 {
1082 {
1055 int v = node[level >> 1];
1083 int v = node[level >> 1];
General Comments 0
You need to be logged in to leave comments. Login now