{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/13701","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/13701/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/13701/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/13701/events","html_url":"https://github.com/JuliaLang/julia/issues/13701","id":112510264,"number":13701,"title":"Extend reinterpret to immutable isbits() type","user":{"login":"uliano","id":5848744,"avatar_url":"https://avatars.githubusercontent.com/u/5848744?v=3","gravatar_id":"","url":"https://api.github.com/users/uliano","html_url":"https://github.com/uliano","followers_url":"https://api.github.com/users/uliano/followers","following_url":"https://api.github.com/users/uliano/following{/other_user}","gists_url":"https://api.github.com/users/uliano/gists{/gist_id}","starred_url":"https://api.github.com/users/uliano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uliano/subscriptions","organizations_url":"https://api.github.com/users/uliano/orgs","repos_url":"https://api.github.com/users/uliano/repos","events_url":"https://api.github.com/users/uliano/events{/privacy}","received_events_url":"https://api.github.com/users/uliano/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2015-10-21T04:26:48Z","updated_at":"2015-10-23T11:08:39Z","closed_at":null,"body":"```\r\njulia> immutable Words32\r\n         lo::UInt32\r\n         hi::UInt32\r\n       end\r\njulia> isbits(Words32)\r\ntrue\r\njulia> a=UInt64(0x123456789abcdef0)\r\n0x123456789abcdef0\r\njulia> b=reinterpret(Words32,a)\r\nERROR: reinterpret: expected bits type as first argument\r\n in reinterpret at essentials.jl:115\r\n```\r\n\r\nBesides the contradiction isbits() != bits type I think that would definitely be useful to be able to reinterpret immutables"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/150545052","html_url":"https://github.com/JuliaLang/julia/issues/13701#issuecomment-150545052","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/13701","id":150545052,"user":{"login":"StefanKarpinski","id":153596,"avatar_url":"https://avatars.githubusercontent.com/u/153596?v=3","gravatar_id":"","url":"https://api.github.com/users/StefanKarpinski","html_url":"https://github.com/StefanKarpinski","followers_url":"https://api.github.com/users/StefanKarpinski/followers","following_url":"https://api.github.com/users/StefanKarpinski/following{/other_user}","gists_url":"https://api.github.com/users/StefanKarpinski/gists{/gist_id}","starred_url":"https://api.github.com/users/StefanKarpinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StefanKarpinski/subscriptions","organizations_url":"https://api.github.com/users/StefanKarpinski/orgs","repos_url":"https://api.github.com/users/StefanKarpinski/repos","events_url":"https://api.github.com/users/StefanKarpinski/events{/privacy}","received_events_url":"https://api.github.com/users/StefanKarpinski/received_events","type":"User","site_admin":false},"created_at":"2015-10-23T11:08:39Z","updated_at":"2015-10-23T11:08:39Z","body":"There are two issues here:\r\n\r\n1. Is there a performance issue in Julia compared to C. The answer seems to be \"no\" – doing the shift is not a performance problem. Your sense that C is \"doing less work\" is based on a mental model of what C code compiles down and operation costs that probably isn't accurate: it only syntactically looks like C is doing less work – there's a strong chance that a C compiler would implement this operation the same way.\r\n\r\n2. Regardless of performance, can we have Julia's reinterpret work in this case – it already works in the array case, can it also be made to work in the scalar case? This could sometimes be convenient and it's a little odd to have cases where `reinterpret(T, [v])` works but `reinterpret(T, v)` doesn't or vice versa."}}