首页 > 编程语言 > 详细

验证一个数组(buffer)中 capacity,index,length 是否合法的方法(代码来自Netty 的byteBuf)

时间:2018-03-30 23:35:48      阅读:223      评论:0      收藏:0      [点我收藏+]

public static boolean isOutOfBounds(int index, int length, int capacity) {
  return (index | length | (index + length) | (capacity - (index + length))) < 0;
}

验证一个数组(buffer)中 capacity,index,length 是否合法的方法(代码来自Netty 的byteBuf)

原文:https://www.cnblogs.com/foxhasdream/p/8679163.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!