Skip to content

Commit f9ea026

Browse files
authored
Fix some bad docs in IdnaMappingTable.kt (#8326)
1 parent 4c62401 commit f9ea026

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

okhttp/src/main/kotlin/okhttp3/internal/idn/IdnaMappingTable.kt

+6-6
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ import okio.BufferedSink
5757
*
5858
* ```
5959
* 0..63 : Length of the UTF-16 sequence that this range maps to. The offset is b2b3.
60-
* 64..79 : Offset by a fixed negative offset. The bottom 4 bits of the offset are the top 4 bits of the offset.
61-
* 80..95 : Offset by a fixed positive offset. The bottom 4 bits of the offset are the top 4 bits of the offset.
60+
* 64..79 : Offset by a fixed negative offset. The bottom 4 bits of b1 are the top 4 bits of the offset.
61+
* 80..95 : Offset by a fixed positive offset. The bottom 4 bits of b1 are the top 4 bits of the offset.
6262
* 119 : Ignored.
6363
* 120 : Valid.
6464
* 121 : Disallowed
@@ -198,7 +198,7 @@ internal class IdnaMappingTable internal constructor(
198198
}
199199

200200
/**
201-
* Binary search [sections] for [codePoint].
201+
* Binary search [sections] for [codePoint], looking at its top 14 bits.
202202
*
203203
* This binary searches over 4-byte entries, and so it needs to adjust binary search indices
204204
* in (by dividing by 4) and out (by multiplying by 4).
@@ -222,7 +222,7 @@ internal class IdnaMappingTable internal constructor(
222222
}
223223

224224
/**
225-
* Binary search [sections] for [codePoint].
225+
* Binary search [ranges] for [codePoint], looking at its bottom 7 bits.
226226
*
227227
* This binary searches over 4-byte entries, and so it needs to adjust binary search indices
228228
* in (by dividing by 4) and out (by multiplying by 4).
@@ -244,7 +244,7 @@ internal class IdnaMappingTable internal constructor(
244244
}
245245

246246
return when {
247-
offset >= 0 -> offset * 4 // This section was found by binary search.
247+
offset >= 0 -> offset * 4 // This entry was found by binary search.
248248
else -> (-offset - 2) * 4 // Not found? Use the preceding element.
249249
}
250250
}
@@ -258,7 +258,7 @@ internal fun String.read14BitInt(index: Int): Int {
258258

259259
/**
260260
* An extremely generic binary search that doesn't know what data it's searching over. The caller
261-
* provides indexes and a comparison function, and this
261+
* provides indexes and a comparison function, and this calls that function iteratively.
262262
*
263263
* @return the index of the match. If no match is found this is `(-1 - insertionPoint)`, where the
264264
* inserting the element at `insertionPoint` will retain sorted order.

0 commit comments

Comments
 (0)