He-Pin commented on code in PR #1247:
URL: https://github.com/apache/pekko/pull/1247#discussion_r1565158079


##########
actor/src/main/scala-2.12/org/apache/pekko/util/ByteString.scala:
##########
@@ -433,6 +447,20 @@ object ByteString {
       }
     }
 
+    override def indexOf(elem: Byte): Int = indexOf(elem, 0)
+    override def indexOf(elem: Byte, from: Int): Int = {
+      if (from >= length) -1
+      else {
+        var found = -1
+        var i = math.max(from, 0)
+        while (i < length && found == -1) {
+          if (bytes(startIndex + i) == elem) found = i
+          i += 1
+        }
+        found

Review Comment:
   how about we extract the `startIndex + 1` to the start of the loop and 
returning a ` found - startIndex`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to