diff --git a/cst337/lec/lec2.md b/cst337/lec/lec2.md index 93cec29..461c3d8 100644 --- a/cst337/lec/lec2.md +++ b/cst337/lec/lec2.md @@ -23,7 +23,7 @@ To find the Negation of any bit-string: > Why? 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. 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. diff --git a/cst337/lec/lec3.md b/cst337/lec/lec3.md new file mode 100644 index 0000000..1e7ae30 --- /dev/null +++ b/cst337/lec/lec3.md @@ -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. + +