用法一
>>(x, n)右位移运算符,x >> n。对于 n >= 0 ,结果是 x 右移 n 位,其中 n >= 0 ,如果 x >= 0 用 0 填充,如果 x < 0 用 1 s 填充,保留符号x 。这相当于 fld(x, 2^n) 。对于 n < 0 ,这等效于 x << -n 。
例子
julia> Int8(13) >> 2
3
julia> bitstring(Int8(13))
"00001101"
julia> bitstring(Int8(3))
"00000011"
julia> Int8(-14) >> 2
-4
julia> bitstring(Int8(-14))
"11110010"
julia> bitstring(Int8(-4))
"11111100"用法二
>>(B::BitVector, n) -> BitVector右位移运算符,B >> n。对于 n >= 0 ,结果是 B 元素向前移动了 n 位置,填充有 false 值。如果 n < 0 ,则元素向后移动。等效于 B << -n 。
例子
julia> B = BitVector([true, false, true, false, false])
5-element BitVector:
 1
 0
 1
 0
 0
julia> B >> 1
5-element BitVector:
 0
 1
 0
 1
 0
julia> B >> -1
5-element BitVector:
 0
 1
 0
 0
 0相关用法
- Julia :>>>用法及代码示例
- Julia :>=用法及代码示例
- Julia :>用法及代码示例
- Julia :<=用法及代码示例
- Julia :∘用法及代码示例
- Julia :==方法用法及代码示例
- Julia :\方法用法及代码示例
- Julia :|用法及代码示例
- Julia :*方法用法及代码示例
- Julia :|>用法及代码示例
- Julia ://用法及代码示例
- Julia :^方法用法及代码示例
- Julia :!==用法及代码示例
- Julia :<<用法及代码示例
- Julia :!=用法及代码示例
- Julia :-方法用法及代码示例
- Julia :⊈用法及代码示例
- Julia :⊊用法及代码示例
- Julia :<用法及代码示例
- Julia :+用法及代码示例
- Julia :~用法及代码示例
- Julia :/用法及代码示例
- Julia :!用法及代码示例
- Julia ::用法及代码示例
- Julia :∉用法及代码示例
注:本文由纯净天空筛选整理自julialang.org 大神的英文原创作品 Base.:>> — Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
