ECS 36A Lecture Notes - Lecture 13: Endianness, Hash Table, Static Variable

166 views4 pages
9 Nov 2018
ECS 36A - Lecture 13 - Functions in Rust
b7... bo there is no choice in the order that this is read, processors have to read all bits
Summation 7 , i=0 of bi2^(i)
b31... b0
Summation of 31, i=0 of bi2^(i)
B3B2B1B0 in this case, B3 is still the most significant byte
-- conceptual representation of
memory, not how it’s actually done -- there is choice here
Big B = Byte, little b = bit
In Big Endian: B3 is at the low address
Why do we call this big then?
When you transmit data over the internet (built to be
architecture-neutral because there didn’t used to be one type of processor -- some in big, some
in little) → the first byte you send is the BIGGEST / Most significant /important one
Internet sends data from low address to high address
In Little Endian: B0 is at the low address
- Send the least significant byte to the low address
Left → Right = Low → High
Each name in Rust represents a memory location, each name in Python is just a variable
for looking up a name in a Hashtable
Rust overwrites memory locations
→ Python rebinds the name to a new value in memory
Rust scope much simpler: Each pair of matching { } define a scope , can have nested
scope -- lifetime of a variable corresponds to the { } it is bound to , inner scope hides the
name of the upper scope:
let x =1,
let x =2
println (“{}”), x); println is not a function, it’s a macro -- can be changed w/ library
println (“{}”, x);
first argument for pritnln is always a string -- “{}” is a placeholder -- expect an argument to
replace it
- # of placeholders must equal the # of arguments
Unlock document

This preview shows page 1 of the document.
Unlock all 4 pages and 3 million more documents.

Already have an account? Log in

Get OneClass Notes+

Unlimited access to class notes and textbook notes.

YearlyBest Value
75% OFF
$8 USD/m
$30 USD/m
You will be charged $96 USD upfront and auto renewed at the end of each cycle. You may cancel anytime under Payment Settings. For more information, see our Terms and Privacy.
Payments are encrypted using 256-bit SSL. Powered by Stripe.