@@ -57,8 +57,8 @@ import okio.BufferedSink
57
57
*
58
58
* ```
59
59
* 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.
62
62
* 119 : Ignored.
63
63
* 120 : Valid.
64
64
* 121 : Disallowed
@@ -198,7 +198,7 @@ internal class IdnaMappingTable internal constructor(
198
198
}
199
199
200
200
/* *
201
- * Binary search [sections] for [codePoint].
201
+ * Binary search [sections] for [codePoint], looking at its top 14 bits .
202
202
*
203
203
* This binary searches over 4-byte entries, and so it needs to adjust binary search indices
204
204
* in (by dividing by 4) and out (by multiplying by 4).
@@ -222,7 +222,7 @@ internal class IdnaMappingTable internal constructor(
222
222
}
223
223
224
224
/* *
225
- * Binary search [sections ] for [codePoint].
225
+ * Binary search [ranges ] for [codePoint], looking at its bottom 7 bits .
226
226
*
227
227
* This binary searches over 4-byte entries, and so it needs to adjust binary search indices
228
228
* in (by dividing by 4) and out (by multiplying by 4).
@@ -244,7 +244,7 @@ internal class IdnaMappingTable internal constructor(
244
244
}
245
245
246
246
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.
248
248
else -> (- offset - 2 ) * 4 // Not found? Use the preceding element.
249
249
}
250
250
}
@@ -258,7 +258,7 @@ internal fun String.read14BitInt(index: Int): Int {
258
258
259
259
/* *
260
260
* 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.
262
262
*
263
263
* @return the index of the match. If no match is found this is `(-1 - insertionPoint)`, where the
264
264
* inserting the element at `insertionPoint` will retain sorted order.
0 commit comments