added lec3 stuff

This commit is contained in:
Medium Fries 2018-09-06 19:23:07 -07:00
parent 6ce39cb065
commit 27adf0c2e2
2 changed files with 25 additions and 1 deletions

View File

@ -23,7 +23,7 @@ To find the Negation of any bit-string:
> Why? > Why?
Because this matters for dealing with `signed` and `unsigned` values. _No it doesn't mean positive and negative numbers._ Because this matters for dealing with `signed` and `unsigned` values. _No it doesn't mean positive and negative numbers._
Say we have 4 bites to mess with. This means we have a range of 0000 to 1111. If we wanted pureley positive numbers in this range we could have 0000 to 1111... or 0 to 15. Say we have 4 bytes to mess with. This means we have a range of 0000 to 1111. If we wanted pureley positive numbers in this range we could have 0000 to 1111... or 0 to 15.
If we needed negative represenation however, we have to sacrifice some of our range. If we needed negative represenation however, we have to sacrifice some of our range.
Our new unsigned range is 0-7. We say it's unsigned because the first bit here is 0. Our new unsigned range is 0-7. We say it's unsigned because the first bit here is 0.
If it were 1 we would have a _signed_ number. If it were 1 we would have a _signed_ number.

24
cst337/lec/lec3.md Normal file
View File

@ -0,0 +1,24 @@
# lec3
> Conceptual things
Until the technical lectures really start, I'll be feeding in a few technical things here and there for the sake of getting used to them.
## One's & Two's Complement
_Previous lecture went over signedness of numbers so this section won't as much_.
One's complement in xor(just flip)
> xor 0xFF, target
Two's complement proccess:
1. Flips bits
2. Add 1
The actual term for this is just __negate__; the other way around is essentially cannon fodder.
## Sign Flag
Set whenever we produce (any) number where the leading bit is set(1).
Regardless if we're dealing with signed or unsigned data.
If we mess with some data but the sign bit remains the same then our sign flag just stays in its current value.