
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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
- Related Questions & Answers
- How to do twos complement on a 16-bit signal using Python?
- 16-bit microprocessors
- 8086 program to reverse 16 bit number using 8 bit operation
- 8085 program to find 1's and 2's complement of 16-bit number
- 8085 program to reverse 16 bit number
- 8085 Program to Divide a 16-bit number by an 8-bit number
- 8086 program to divide a 16 bit number by an 8 bit number
- 8085 program to add two 16 bit numbers
- 8086 program to multiply two 16-bit numbers
- 8085 program to divide two 16 bit numbers
- 8085 Program to convert a 16-bit binary number to BCD
- 8085 program to swap two 16-bit numbers using Direct addressing mode
- C# Bitwise and Bit Shift Operators
- 8085 Program to multiply two 16-bit binary numbers
- 8086 program to subtract two 16 bit BCD numbers
Advertisements