{"action":"created","issue":{"url":"https://api.github.com/repos/JCTools/JCTools/issues/45","labels_url":"https://api.github.com/repos/JCTools/JCTools/issues/45/labels{/name}","comments_url":"https://api.github.com/repos/JCTools/JCTools/issues/45/comments","events_url":"https://api.github.com/repos/JCTools/JCTools/issues/45/events","html_url":"https://github.com/JCTools/JCTools/issues/45","id":53386069,"number":45,"title":"SpscGrowableArrayQueue two bugs?","user":{"login":"akarnokd","id":1269832,"avatar_url":"https://avatars.githubusercontent.com/u/1269832?v=3","gravatar_id":"","url":"https://api.github.com/users/akarnokd","html_url":"https://github.com/akarnokd","followers_url":"https://api.github.com/users/akarnokd/followers","following_url":"https://api.github.com/users/akarnokd/following{/other_user}","gists_url":"https://api.github.com/users/akarnokd/gists{/gist_id}","starred_url":"https://api.github.com/users/akarnokd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akarnokd/subscriptions","organizations_url":"https://api.github.com/users/akarnokd/orgs","repos_url":"https://api.github.com/users/akarnokd/repos","events_url":"https://api.github.com/users/akarnokd/events{/privacy}","received_events_url":"https://api.github.com/users/akarnokd/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-01-05T11:14:16Z","updated_at":"2015-01-05T13:44:33Z","closed_at":"2015-01-05T13:39:03Z","body":"I found two more bugs:\r\n\r\nL91: should allow initial size to be equal to max size and thus not growing.\r\n\r\nL138-145: there is a missing case when the queue is at max capacity and there is exactly one space left: L138 checks if the index + 1 is occupied thus in the max capacity case, one can't have 128 elements in the queue but only 127; in the below max case, it won't use cell at index unless index + 1 is occupied, which is odd. I think the correct check would be:\r\n```java\r\nif (null == lvElement(buffer, calcElementOffset(index + 1, mask))) { // buffer is not full\r\n    return writeToQueue(buffer, e, index, offset);\r\n} else if (mask == maxSize) {\r\n    if (null == lvElement(buffer, offset)) {\r\n        return writeToQueue(buffer, e, index, offset);\r\n    }\r\n    // we're full and can't grow\r\n    return false;\r\n}\r\n```\r\n\r\nNote the == check."},"comment":{"url":"https://api.github.com/repos/JCTools/JCTools/issues/comments/68708951","html_url":"https://github.com/JCTools/JCTools/issues/45#issuecomment-68708951","issue_url":"https://api.github.com/repos/JCTools/JCTools/issues/45","id":68708951,"user":{"login":"nitsanw","id":2692655,"avatar_url":"https://avatars.githubusercontent.com/u/2692655?v=3","gravatar_id":"","url":"https://api.github.com/users/nitsanw","html_url":"https://github.com/nitsanw","followers_url":"https://api.github.com/users/nitsanw/followers","following_url":"https://api.github.com/users/nitsanw/following{/other_user}","gists_url":"https://api.github.com/users/nitsanw/gists{/gist_id}","starred_url":"https://api.github.com/users/nitsanw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nitsanw/subscriptions","organizations_url":"https://api.github.com/users/nitsanw/orgs","repos_url":"https://api.github.com/users/nitsanw/repos","events_url":"https://api.github.com/users/nitsanw/events{/privacy}","received_events_url":"https://api.github.com/users/nitsanw/received_events","type":"User","site_admin":false},"created_at":"2015-01-05T13:44:33Z","updated_at":"2015-01-05T13:44:33Z","body":"@akarnokd Also, did you re-benchmark for your use case using new implementation?"}}