- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to do bitwise complement on a 16-bit signal using Python?
If you want to get an inversion of only first 16 bits of a number, you can take a xor of that number with 65535(16 1s in binary).
example
a = 3 # 11 in binary b = a ^ 65535 print(bin(b))
Output
This will give the output −
0b1111111111111100
Advertisements