# Bit Manipulation Instruction Set

**URL:** <https://discourse.julialang.org/t/bit-manipulation-instruction-set/5368>\
**Category:** General Usage\
**Tags:** question\
**Created:** [August 14, 2017, 2:49am UTC](https://discourse.julialang.org/t/bit-manipulation-instruction-set/5368 "2017-08-14T02:49:18Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![bennedich](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bennedich/32/4894_2.png) [@bennedich](https://discourse.julialang.org/u/bennedich)\
**Post date:** [January 12, 2019, 8:46am UTC](https://discourse.julialang.org/t/bit-manipulation-instruction-set/5368/9 "2019-01-12T08:46:17Z")

</div>

I’ve used this:

```julia
function has_bmi2()
    CPUInfo = zeros(Int32, 4)
    ccall(:jl_cpuidex, Cvoid, (Ptr{Cint}, Cint, Cint), CPUInfo, 7, 0)
    CPUInfo[2] & 0x100 != 0
end

```

Cf. [this post](https://discourse.julialang.org/t/interleaving-bits-z-order-curve-morton-code-transpose-binary-matrix/18458/6). There’s also [CpuId.jl](https://github.com/m-j-w/CpuId.jl).

---

_[View the full topic](https://discourse.julialang.org/t/bit-manipulation-instruction-set/5368)._
