{"action":"created","issue":{"url":"https://api.github.com/repos/dlang/druntime/issues/1517","repository_url":"https://api.github.com/repos/dlang/druntime","labels_url":"https://api.github.com/repos/dlang/druntime/issues/1517/labels{/name}","comments_url":"https://api.github.com/repos/dlang/druntime/issues/1517/comments","events_url":"https://api.github.com/repos/dlang/druntime/issues/1517/events","html_url":"https://github.com/dlang/druntime/pull/1517","id":142596506,"number":1517,"title":"Implement a software fallback algorithm for core.bitop.bsf() and bsr()","user":{"login":"tsbockman","id":1332026,"avatar_url":"https://avatars.githubusercontent.com/u/1332026?v=3","gravatar_id":"","url":"https://api.github.com/users/tsbockman","html_url":"https://github.com/tsbockman","followers_url":"https://api.github.com/users/tsbockman/followers","following_url":"https://api.github.com/users/tsbockman/following{/other_user}","gists_url":"https://api.github.com/users/tsbockman/gists{/gist_id}","starred_url":"https://api.github.com/users/tsbockman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsbockman/subscriptions","organizations_url":"https://api.github.com/users/tsbockman/orgs","repos_url":"https://api.github.com/users/tsbockman/repos","events_url":"https://api.github.com/users/tsbockman/events{/privacy}","received_events_url":"https://api.github.com/users/tsbockman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-03-22T09:46:31Z","updated_at":"2016-05-07T19:47:40Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/dlang/druntime/pulls/1517","html_url":"https://github.com/dlang/druntime/pull/1517","diff_url":"https://github.com/dlang/druntime/pull/1517.diff","patch_url":"https://github.com/dlang/druntime/pull/1517.patch"},"body":"This pull request is intended to supersede [PR #1486](https://github.com/D-Programming-Language/druntime/pull/1486#issuecomment-199689712).\r\n\r\nThis fixes an issue identified by @denis-sh with the `ulong` versions that [I previously added](https://github.com/D-Programming-Language/druntime/pull/1452) to `core.bitop` for `bsf()` and `bsr()`: the `ulong` overloads were defined to forward to the `size_t` versions on 64-bit, but then `size_t` is just an alias for `ulong`, which would make the function infinitely recursive.\r\n\r\nThis was not a problem in testing, because on 64-bit the `ulong` function body is replaced by a compiler intrinsic on all current DMD platforms.\r\n\r\nStill, this pull request solves this potential issue by adding a software fallback algorithm for bit scans - `softScan()` - just in case someone wants to use `bsf()` or `bsr()` on a platform where they are not intrinsics.\r\n\r\nThere is no longer an explicit `size_t` overload of `bsf()` or `bsr()`; instead there are separate `uint` and `ulong` overloads, each of which forwards to the overload which is expected to be an intrinsic on the current platform. The expected intrinsic, in turn, falls back to `softScan()` if needed."},"comment":{"url":"https://api.github.com/repos/dlang/druntime/issues/comments/217664869","html_url":"https://github.com/dlang/druntime/pull/1517#issuecomment-217664869","issue_url":"https://api.github.com/repos/dlang/druntime/issues/1517","id":217664869,"user":{"login":"DmitryOlshansky","id":281770,"avatar_url":"https://avatars.githubusercontent.com/u/281770?v=3","gravatar_id":"","url":"https://api.github.com/users/DmitryOlshansky","html_url":"https://github.com/DmitryOlshansky","followers_url":"https://api.github.com/users/DmitryOlshansky/followers","following_url":"https://api.github.com/users/DmitryOlshansky/following{/other_user}","gists_url":"https://api.github.com/users/DmitryOlshansky/gists{/gist_id}","starred_url":"https://api.github.com/users/DmitryOlshansky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DmitryOlshansky/subscriptions","organizations_url":"https://api.github.com/users/DmitryOlshansky/orgs","repos_url":"https://api.github.com/users/DmitryOlshansky/repos","events_url":"https://api.github.com/users/DmitryOlshansky/events{/privacy}","received_events_url":"https://api.github.com/users/DmitryOlshansky/received_events","type":"User","site_admin":false},"created_at":"2016-05-07T19:47:40Z","updated_at":"2016-05-07T19:47:40Z","body":"Auto-merge toggled on"}}