Lines Matching refs:ofs
1380 Py_ssize_t ofs;
1388 ofs = 1;
1391 * a[hint + lastofs] < key <= a[hint + ofs]
1394 while (ofs < maxofs) {
1395 IFLT(a[ofs], key) {
1396 lastofs = ofs;
1397 assert(ofs <= (PY_SSIZE_T_MAX - 1) / 2);
1398 ofs = (ofs << 1) + 1;
1400 else /* key <= a[hint + ofs] */
1403 if (ofs > maxofs)
1404 ofs = maxofs;
1407 ofs += hint;
1411 * a[hint - ofs] < key <= a[hint - lastofs]
1414 while (ofs < maxofs) {
1415 IFLT(*(a-ofs), key)
1417 /* key <= a[hint - ofs] */
1418 lastofs = ofs;
1419 assert(ofs <= (PY_SSIZE_T_MAX - 1) / 2);
1420 ofs = (ofs << 1) + 1;
1422 if (ofs > maxofs)
1423 ofs = maxofs;
1426 lastofs = hint - ofs;
1427 ofs = hint - k;
1431 assert(-1 <= lastofs && lastofs < ofs && ofs <= n);
1432 /* Now a[lastofs] < key <= a[ofs], so key belongs somewhere to the
1433 * right of lastofs but no farther right than ofs. Do a binary
1434 * search, with invariant a[lastofs-1] < key <= a[ofs].
1437 while (lastofs < ofs) {
1438 Py_ssize_t m = lastofs + ((ofs - lastofs) >> 1);
1443 ofs = m; /* key <= a[m] */
1445 assert(lastofs == ofs); /* so a[ofs-1] < key <= a[ofs] */
1446 return ofs;
1469 Py_ssize_t ofs;
1477 ofs = 1;
1480 * a[hint - ofs] <= key < a[hint - lastofs]
1483 while (ofs < maxofs) {
1484 IFLT(key, *(a-ofs)) {
1485 lastofs = ofs;
1486 assert(ofs <= (PY_SSIZE_T_MAX - 1) / 2);
1487 ofs = (ofs << 1) + 1;
1489 else /* a[hint - ofs] <= key */
1492 if (ofs > maxofs)
1493 ofs = maxofs;
1496 lastofs = hint - ofs;
1497 ofs = hint - k;
1501 * a[hint + lastofs] <= key < a[hint + ofs]
1504 while (ofs < maxofs) {
1505 IFLT(key, a[ofs])
1507 /* a[hint + ofs] <= key */
1508 lastofs = ofs;
1509 assert(ofs <= (PY_SSIZE_T_MAX - 1) / 2);
1510 ofs = (ofs << 1) + 1;
1512 if (ofs > maxofs)
1513 ofs = maxofs;
1516 ofs += hint;
1520 assert(-1 <= lastofs && lastofs < ofs && ofs <= n);
1521 /* Now a[lastofs] <= key < a[ofs], so key belongs somewhere to the
1522 * right of lastofs but no farther right than ofs. Do a binary
1523 * search, with invariant a[lastofs-1] <= key < a[ofs].
1526 while (lastofs < ofs) {
1527 Py_ssize_t m = lastofs + ((ofs - lastofs) >> 1);
1530 ofs = m; /* key < a[m] */
1534 assert(lastofs == ofs); /* so a[ofs-1] <= key < a[ofs] */
1535 return ofs;