Hello, this is Dr. Miller and this
is Episode fourteen point sixteen of
Assembly.
Today, we're going to talk about
standard types and those are going
to include integers,
long shorts and bytes in
C, and then we'll see how they
manifest themselves inside of
assembly standards,
integer types.
If you look inside the standard
library, there is a standard energy
library and this is in standard A.H.
And what this does is it provides us
with specific with integers.
And so, for example,
you will see some identifiers.
So you will mean that this
is unsigned and it's not
required. But you can have unsigned
versus signed, you can
have int.
And that means that this is an
integer and then we'll have a
specific set of bits.
So eight, 16, 32,
or there are other bit
bits that we can use and
then at the end we'll see an
underscore t an adult tell us that
this is a defined
type that we can use.
And so an example here is in
16 underscore T..
So as we go through these different
types, you're going to see these
different definitions.
So integers, so a standard
integer is going to be a D word size
or it's going to be thirty two bits
and again, we should know that they
hold whole numbers and then we have
a couple of different types.
So we have int 30 to
underscore T and you aren't 30
to underscore T..
And so these are the universal types
that you can use to guarantee that
you're going to have thirty two bits
for an integer and then it's either
signed or unsigned.
So we're here, we have some examples
and we'll see that the energy here
is going to be the same as the U.S.
And so when we look at the
assignments, we're going to either
code words, right.
And so that tells us that this is
thirty two bits in assembly.
And so we can see in here, all these
different types are different D
words, and then how they get used
will be determined by
things. For example, the you versus
the not. And so we'll see some
examples in the in the
future where those are not used.
And when you really see it is when
you when you change the sizes,
so here we're going to use an eight
for these different ones.
And when we look over here, we can
see the sign versus the unsign.
When we copy the data out,
it's either going to use a zero
extend or a sign extend.
So if it's if it doesn't have
a sign or use a zero extend, if
it does have a sign, then you sign
extend. And so you can know if this
is stored in TEUs compliment
or if it's just a straight up
integer.
And so we see here we have
C, which is an unsigned one,
but C is going to be bigger than
these eight bit ones.
And so when it moves the data, it's
going to copy thirty two
bits and then it will do the zero
extend. So then when it saves into
the register, it is cleared out all
the junk that's at the top.
And so it'll save an entire D word,
even though when you look up here
you can see that these are bytes.
Right. So the
estate or you end eight
are going to be bytes.
And so it's storing those using one
byte.
But then when we do our 32 bit
integers, we see that it uses
a D word.
So we also have short,
so short is a size that
is 16 bits, and then we
can use either, again, a zero extend
or a sign extend, and then
it uses the notation assembly of
word.
And so when you're going to see a
16 or a short and
so these are going to get treated
similarly, you're going to see that
it will use the key word word
here. So it's a word pointer.
So it's going to copy 16
bits instead of copying thirty two
or eight or sixty for.
And again, when we look here, we can
see that we either have zero extend
or extend, and that's based on
the input types of it's A or B.
So A we get zero extend.
B, we get an extension.
And that's because one is signed and
one is unsigned.
All right, long.
So long provides either four or
eight bites, and this actually
depends on the architecture that
you're looking at. So in the
programing programing language, see,
it's going to be thirty two bits on
30 to Bitsie and 64 bits
on 64 Bitsie.
So you have to understand what
you're compiling for in order to
understand how that's going to
manifest itself.
But then we also have long, long,
which will guarantee that we are 64
bit so in regular C
along versus an and are going to
give us the same size.
But on sixty four bit we can,
we can use along to give us
64 bits and then we can use longlong
in either case if we want to
guarantee that we have 64 bits.
So, again, we can see here that
if we're in 30 to Bitsie and
we declare a long, long,
we'll end up seeing that it's going
to end up taking two D word
pointers. Right, because generally
you don't have the ability to access
64 bits.
And so it has to use D word copies
for that.
And then all the rest of them we see
these are long or in sixty
fours and we're going to see that
those end up getting moved in there
again using a couple of different
operations.
B But
now we can see that if we use a
long on a 64 bit
we end up.
So this is sixty four bit C
it uses the Q word in
order to store that.
And so we can see that each one
of these only took one operation or
we didn't have to use two to assign
values to the long or the long long.
So the character Energous last
bite.
So most times when you're programing
and see you're again going to use
characters and so characters
are signed and they are equivalent
to the end date, underscore t,
but if you want to have the ability
to have unsign, you can use ont
eight underscore t,
you can also use an eight underscore
t if you want to be very specific
that this is not a character and so
you shouldn't be assigning
characters to it.
And so that's, that's what
characters are. And so if you need
to do something with bytes then you
end up using most people
would end up using a Unit eight
for that because you don't want to
accidentally lose
some bits when we do find
operations.
So here again, we can see that
we are seeing the byte in
here. So that means that this is a
character and that's sort of a
giveaway. If you see that something
is starring in a bite, then that
means it's generally a character
or it's going to use that ONT eight
underscore T or into eight
underscore T in order to store
it. And so we can see again the sign
extensions and then comparing
we'll see that we have a sign extend
for both of these.
So B and B one.
So a character is an eight
underscore T
and gets treated the same.
So today, we talked about some of
the standard types,
the library that you can include in
order to basically decide how
long you want a variable to
be. And then we talked about
integers, longs, shorts,
and then bites in C
and how they manifest themselves
inside of your assembly code when
you're looking at that.
So here's our quiz, how many bits
are in a long, long?
And the answer is always 64
bits.
How many bits are on a U.S.
eight, U.S.
16 underscore T.
16 bits, because we have a number
16 there,
if you have questions, you can
e-mail me millirems, you and Kyra
Edu and you can find me on Twitter
at now house 30.