localhost:1313/~anderson/teaching/3891/lecture/1/#p1anderson/teaching/3891/lecture/1/notes.pdf ·...
TRANSCRIPT
mul ; unsigned integer multiplicationimul ; signed integer multiplicationfmul ; floating-point multiplicationmulps ; multiply packed single-precision floatsvfmaddpd ; fused multiply-add of packed double-pre...; even more!
Types in processors
16 / 26
Basic types:
bool b = true;char c = '?';int n = 1000000;double x = 3.1415926;string name = "Jonathan Anderson";
Types in C++
18 / 26
boolcharintfloatdouble
string
Specific integers
#include <stdint.h>
// Signed integers:int8_t a = 127; // 0x7fint16_t a = 32767; // 0x7fffint32_t a = 2147483647; // 0x7fffffffint64_t a = 9223372036854775807; // 0x7fffffffffffffff
// Unsigned integers:uint8_t a = 255; // 0xffuint16_t a = 65535; // 0xffffuint32_t a = 4294967295; // 0xffffffffuint64_t a = 18446744073709551615;// 0xffffffffffffffff
Types in C++
19 / 26
char int
bool b = true;
char c = '?';int n = 1000000;double x = 3.1415926;string name = "Jonathan Anderson";
What's in a name?
some characters and an integer length(roughly!)
string is a class that defines a new type
More complicated types
21 / 26
string
string
Common operators:Operator Operation
Operator Operation
== Equals!= Not equal> Greater than< Less than>= Greater than or equal<= Less than or equal
Operations
23 / 26
truefalse
=
Common operators:Operator Operation Applies to
Operator Operation Applies to
+ Add int, doubleConcatenatestring
- Subtract int, double* Multiply int, double/ Divide int, double% Modulus int
Operations
24 / 26
truefalse
+
Common operators:Operator Operation Applies to
Operator Operation Applies to
+= Add & assign int, doubleAppend string
-= Subtract & assignint, double*= Multiply & assign int, double++ Increment int, double, iterators, ...-- Decrement int, double, iterators, ...
OperationsOperations
25 / 26
++ --