Published: 25 Jan 2019 › Updated: 25 Jan 2019![[Grammer] 23 - Bitwise Operators, 24 - Identity Operator](/nhc-explorer-cover.webp)
![[Grammer] 23 - Bitwise Operators, 24 - Identity Operator](/nhc-explorer-cover.webp)
[Grammer] 23 - Bitwise Operators, 24 - Identity Operator
Bitwise Operators
메모리에 저장된 실제 비트를 다룸. 연산 속도가 빠르고 코드가 짧음.
비트 연산은 정수만 가능함.(실수 x, 문자열x)
&, |, ^, ~, <<, >>
a : 0 0 1 0 0 0 1 1
b : 0 0 0 1 1 0 1 0
& : 0 0 0 0 0 0 1 0 (AND)
| : 0 0 1 1 1 0 1 1 (OR)
^ : 0 0 1 1 1 0 0 1 (XOR)
~ (NOT)
a << n : a * (2^n)
a >> n : a / (2^n)Identity Operator(항등 연산자) : ===, !== 사용, 클래스 타입의 값을 비교
class A { }
let a = A()
let b = a
let c = A()
a === b // true
a === c // false
Leave [Grammer] 23 - Bitwise Operators, 24 - Identity Operator to:
Read more #swift4 posts
Best Posts From gunw
We have not curated any of gunw's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From gunw
- [Grammer] 26 - Custom Operators
- [Grammer] 25 - Operator Methods
- [Grammer] 23 - Bitwise Operators, 24 - Identity Operator
- [Grammer]21 - Ternary Coditional Operator, 22 - Range Operators
- [Grammer] 19 - Short-circuit Evaluation, Side Effect, 20 - Assignment Operators
- [Grammer] 16 - Overflow Operators, 17 - Comparison Operators, 18 - Logical Operators
- [Grammer] 13 - Data Types with Memory, 14 - Operator Basics, 15 - Arithmetic Operators
- [Grammer] 11 - Type Inference, Type Safety, 12 - Type Conversion, Type Aliases
- [Grammer] 09 - Boolean, 10 - Strings and Characters
- [Grammer] 07 - Naming Convention, 08 - Numbers