Hello. This is Dr Miller in this episode 14.16 of assembly.
Today we're gonna talk about standard types and those they're gonna include
imagers long shorts and bites NC. And then we'll see how they manifest themselves inside of assembly.
Standard your energy types.
If we look inside the standard library, there is a standard imager library, and this is in standard and dot h.
And what this does is it provides us with specific with imagers. And so, for example, you will see some identifiers, so a you will mean this is unsigned. Um, it's not required, but you can have unsigned versus signed,
you can have int. And that means that this is an imager. And then we'll have ah specific set of bits. So 8 16 32 or there are other bit Ah,
this that we can use.
And at the end, we'll see an underscore tea and adult tell us that this is a,
um defined type that we can use. And so an example here is U N 16 underscore t.
So, as we go through these different types, you're going to see these different definitions.
So imagers so a standard energia is gonna be a d word size or it's going to be 32 bits.
And again we should know that they hold whole numbers and then we have a couple different types, so we have int
32 underscore T and U N 30 to underscore t.
So these are the universal types that you can use to guarantee that you're gonna have 32 bits for an imager, and then it's either signed or unsigned.
So we're here. We have some examples,
and we'll see that the manager here is gonna be the same as the U. N. And so when we look at the assignments were going to either to see d words,
right? And so that tells us that this is 32 bits in assembly,
and so we can see in here all these different types are different. The words and then how they get used will be determined by things. For example, the U versus the not and so we'll see some examples in in
the future where those air not used
and when you really see it is when you when you change the sizes, So here we're going to use an into eight for these different ones, and we look over here, we can see the sign versus the unsigned. When we copy the data out, it's either going to use a zero extend or a sign extent. So if it's
if it doesn't have a sign, you will use a zero extend. If it does have a sign that are you sign extending so you can know if this is
I'm stored in two's complement or if it's just a straight up imager.
And so we see here we have,
um C, which is an unsigned one. But see is going to be bigger than these eight bit ones. And so when it moves the data, it's gonna copy 32 bits, and then it will do. The zero extends. 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 air bites
um, into eight or you end eight are gonna be bites. And so it's storing those using one bite.
But then, when we do, our 32 bit imagers. We see that it uses a D word
So short is a size that is 16 bits, and then we can use either again a zero extend or a sign extend a minute, uses the notation assembly of word.
And so when you're going to see a 16 or a short and so these air going to get treated,
um, similarly, you're going to see that it will use the key word word here. So it's a word pointer. So it's gonna copy,
um, 16 bits instead of copying 32 or eight or 64
and again, When we look here, we can see that we either have zero extend or sign extent, and that's based on
the input types of its air B. So a. We get zero extend b, we get sign extend, and that's because one assigned in one is unsigned.
So long provides either for a bites. And this actually depends on the architecture that you're looking at. So in the programming programming language, see, it's going to be 32 bits on 32 bit see and 64 bits on 64 bit see
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 sea along versus an end are going to give us the same size. But on 64 bit we can we can use along to give us 64 bits and then we can use long, long in either case, if we want to guarantee that we have 64 bits.
So again we can see here that, um if we're in 32 bit see and we declare a long long,
we'll end up seeing that it's gonna end up taking two d word pointers, right? Cause 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 air long or in 60 fours, and we're going to see that those end up getting moved in there,
um, again, using a couple different operations.
But now we can see that if we use a long on a 64 bit
we end up eso. This is 64 bit. See, It uses a cue word. I'm in order to store that, and so we can see that each one of these only took one operation where we didn't have to use to to assign values to the long or the long long
so the character or imager slash bite.
So most times when you're programming and see your again going to use, um,
characters and so characters air signed and they are equivalent to the end. Eight Underscore T.
But if you want to have the ability to have unsigned, you can use U. N 28 underscore T. You can also use into eight underscore tea. 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 bites, then you end up using.
Most people would end up using a U. N. Eight for that because you don't want to accidentally lose some bits when we do signed operations.
So here again we can see that
we are seeing the bite in here. So that means that this is a character, and that's sort of a giveaway. If you see that something is storing in a bite, then that means it's generally a character, or it's going to use that u N 28 underscore tea or into eight underscore t in order to store it. And so we can see again the sign extensions
Um, we'll see that we have a sign extent for both of these, so B and B one. So a character is an into eight underscore t
it gets treated the same.
So today we talked about some of the standard types,
um, the library that you can include in order to basically decide how long you want a variable to be.
And then we talked about imagers, 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 Maney bits are in a Long Long
and the answer is always 64 bits.
How many bits are on a U. N eight you int 16 underscore t
16 bits because we have, ah, number 16 there.
If you have questions, you can email me, Miller, MJ, you and Kate Ie to you, and you can find me on Twitter at no house 30.