[ https://issues.apache.org/jira/browse/HTTPCORE-535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16542497#comment-16542497 ]
ASF GitHub Bot commented on HTTPCORE-535: ----------------------------------------- GitHub user xiaohu-zhang opened a pull request: https://github.com/apache/httpcomponents-core/pull/69 HTTPCORE-535 if workerCount is power of two , use &(workerCount -1 ) achieve mod workerCount funciton You can merge this pull request into a Git repository by running: $ git pull https://github.com/xiaohu-zhang/httpcomponents-core modimprove Alternatively you can review and apply these changes as the patch at: https://github.com/apache/httpcomponents-core/pull/69.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #69 ---- commit f09dc15f34f385ab426f1b1dc40faffb23834d91 Author: xiaohu-zhang <silver9886@...> Date: 2018-07-13T03:37:48Z HTTPCORE-535 if workerCount is power of two , use &(workerCount -1 ) achieve mod workerCount funciton ---- > mod workerCount is power of two can be improved as &(workerCount-1) > -------------------------------------------------------------------- > > Key: HTTPCORE-535 > URL: https://issues.apache.org/jira/browse/HTTPCORE-535 > Project: HttpComponents HttpCore > Issue Type: Improvement > Components: HttpCore NIO > Reporter: silver9886 > Priority: Critical > > if workerCount is power of two . improve > final int i = Math.abs(currentWorker.incrementAndGet() % workerCount); > to be > final int i = Math.abs(currentWorker.incrementAndGet() & (workerCount-1) ); -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org