Why do you use Int for numbers in your programs? Shouldn't you be using short? Are you really calculating and working with numbers higher than 32787 (or 65535 unsigned)? Unless you are, you should use shorts. Why aren't you using shorts? Shorts are great. Shorts are love. Shorts are life!


Other urls found in this thread:

It takes more cycles to perform the bitshift from the CPU's native datatype. Kill yourself, or come back when you graduate CS101, kiddo.

usize by default then?

But that's just the minimum required size for ints.

Because chicks dig longs.

chad uses longs for everything.

Why did you make the same thread in halfchan?

It doesn't, though. We're not using Alpha shit anymore, grandpa.

Remember to not try to store your long long in short shorts.

Maybe he's using a real computer like pic-related.

That statement offends my CoC.

nice long doubles

all joking aside, 32-bit float and integer operations easily outperform 64-bit operations -- by a factor of 2. CPU literally does half the work.
If you're doing a bunch of work with a bunch of numbers, consider early how much precision you need.
dunno if this applies to shorts though. maybe if OP's picture were more to my tastes.

Daily reminder FORTH users don't have these problems.

everyone ITT is LARPing because the proper way to use integers for speed in C is to use a "fast" integer instead of fixed size. and if you're using any other PL, you really shouldn't be pretending to care about speed of arithmetic. if you're using an assembler, you aren't using retard words like "long", "short", etc

I'm sorry did you just ASSUME the bit-width of short and int on my machine?!?! I really hope nobody here actually uses integral data types other than char, size_t/ssize_t, and stdint types. Jeez

like C++ or Rust, for example?


You do realize that anything shorter than an int is promoted to int anyway whenever actually used? You do realize that '\0' or 'a' are of type int in C? shorts are only really useful if you're literaly short on memory where you store them (such as embedded etc.).

Nice try, off-by-one-Satan.

Speed is not the only possible problem, there's also memory. Sometimes you don't care much about speed but need to fit small memory. Also

Computing almost always involves a trade-off between being processing and memory. For instance in the 90s, when CPUs were too weak to render cutscenes in realtime or decode compressed audio formats in a game but the new CD-ROM medium offered much space, you had most of the CD's space filled with pre-rendered cutscenes and/or CD audio music. You traded memory to save on processing. Later when CPUs were more powerful, they rendered cutscenes and decoded compressed audio in realtime, and the space on the CDs was devoted to other games assets so the games themselves could be bigger. You traded processing to regain memory (in the form of space on the CD) for other purposes. That's just one example, but decisions about tradeoffs like these need to be made quite often (not as much as it used to be the case, but in situations like embedded sofware where both processing power and available memory is short, it's still very important).

why the fuck would i waste my memory?

At least use the standard uint8_t

Ya blew it.

long long cock = deep_in_ops_ass();

low memory is for double niggers.

Ya done goofed. Double uses the most memory.


Any float is implicitly promoted to double anyway, and floats only have a 24 bit mantissa (about 7 decimal significant figures) which leads to rounding errors accumulating pretty fast. It's for good reasons that int and double are default types and anything shorter needs to be used explicitly by someone who knows what and why he's doing.