1.4.1 Data Types

0.0(0)
Studied by 1 person
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/13

flashcard set

Earn XP

Description and Tags

Last updated 8:22 AM on 10/17/23
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

14 Terms

1
New cards
Character set
A collection of symbols and their binary/hex values
2
New cards
Why is the ASCII character set unsuitable in a modern world?
There are lots of different languages that have different characters in their alphabets that aren't covered in the ASCII character set
3
New cards
What is the normalised format of negative floating point numbers?
10
4
New cards
What is the normalised format of positive floating point numbers?
01
5
New cards

Where are bitwise manipulations commonly used?

  • Quickly doubling or halving numbers

  • Encryption and decryption (key manipulation)

  • Serial communication protocols

  • Handling network addresses

  • Setting/resetting flags

  • Sensing flag values

  • Data collision detection in networks

  • Graphics manipulation

  • Compression algorithms

6
New cards

Logical (Unsigned) Shift Left

  • All digits are moved to the left. 

  • The most significant bit (MSB) is removed and a 0 is added in place of the least significant bit (LSB). 

  • The MSB is moved into a carry flag.

  • With logical shifts, the sign is not preserved.

  • Most of the time when you shift a binary number left, the value is doubled.

  • However if the MSB was 1, that value will be lost and the number won’t be doubled.

  • Therefore, left wise shift works for positive numbers up to 127.

7
New cards

Logical (Unsigned) Right Shift

  • All digits are moved to the right. 

  • The least significant bit (LSB) is removed and a 0 is added in place of the most significant bit (MSB).

  • With logical shift right, the sign is not preserved.

  • As long as there is no 1 in the LSB, each right shift divides the number by 2.

8
New cards

Circular Shift

  • With a circular right shift, the LSB is copied in to the MSB and everything else is shifted right

  • With a circular left shift, the MSB is copied in to the LSB and everything else is shifted left

  • Widely used in error correction algorithms to generate a set of error correcting code words.

  • It is also used in serial data transfer to swap register values between two devices

<ul><li><p><span style="font-family: Calibri">With a circular right shift, the LSB is copied in to the MSB and everything else is shifted right </span></p></li><li><p><span style="font-family: Calibri">With a circular left shift, the MSB is copied in to the LSB and everything else is shifted left</span></p></li><li><p><span style="font-family: Calibri">Widely used in error correction algorithms to generate a set of error correcting code words.</span></p></li><li><p><span style="font-family: Calibri">It is also used in serial data transfer to swap register values between two devices</span></p></li></ul>
9
New cards

Arithmetic (Signed) Right Shift

  • All digits are moved to the right except the MSB which stays the same in order to preserve the negative or positive state of the number.

  • This has the same effect as padding with a 1 for negative numbers or with a 0 for positive numbers.

  • The least significant bit (LSB) is removed. 

10
New cards

Arithmetic (Singed) Left Shift

  • All digits are moved to the left except the MSB which stays the same in order to preserve the negative or positive state of the number.

  • The least significant bit (LSB) is padded with a zero. 

11
New cards

Masking

  • Allows you to check the value of a particular bit in a binary number and is used because it is not possible to read and write those bits individually

  • exploits the properties of logical operators in such a way as to allow us to determine and/or change the state of one bit without affecting the state of the other bits.

12
New cards

AND Masking

  • If you wanted to find the value of the 5th bit of an 8 bit binary number (counting from the left or most significant bit) 10101010

  • You would use the mask 00001000

  • The mask uses 0s in for each bit value except the position of the bit that you want to check in the binary number.

  • A logical AND operation is then performed on the two numbers

  • A common use is IP addressing. The subnet mask extracts the network address of a device from its IP address

  • Network switches and bridges use this to work out if two devices are on the same network.

13
New cards

OR masking (setting a bit value)

  • Perform the logical function OR on a mask and a data bit

  • It is quite common for a program to have a set of flags (which are single bits) stored in a single byte or word to help keep track of events in the program.

  • The OR bit operation is used to set each flag when needed.

14
New cards

XOR masking (toggling a bit value)

  • Perform the logical function XOR on a mask and a data bit

  • This is commonly used to toggle the value of flags.