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!
S H O R T S
H
O
R
T
S
22 months ago
Other urls found in this thread:
youtube.com/watch?v=LJoRyxRcj4A
It takes more cycles to perform the bitshift from the CPU's native datatype. Kill yourself, or come back when you graduate CS101, kiddo.
22 months ago
But that's just the minimum required size for ints.
22 months ago
Because chicks dig longs.
22 months ago
chad uses longs for everything.
22 months ago
Why did you make the same thread in halfchan?
22 months ago
It doesn't, though. We're not using Alpha shit anymore, grandpa.
22 months ago
Remember to not try to store your long long in short shorts.
22 months ago
Maybe he's using a real computer like pic-related.
22 months ago
That statement offends my CoC.
22 months ago
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.
22 months ago
Daily reminder FORTH users don't have these problems.
youtube.com/watch?v=LJoRyxRcj4A
22 months ago
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
22 months ago
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
22 months ago
C…
and if you're using any other PL, you really shouldn't be pretending to care about speed of arithmetic
any other PL
like C++ or Rust, for example?
22 months ago
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? short
s are only really useful if you're literaly short on memory where you store them (such as embedded etc.).
22 months ago
he doesn't do real-mode DOS programming where int equals short
Nice try, off-by-one-Satan.
22 months ago
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
22 months ago
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).
22 months ago
tfw mostly using u8
why the fuck would i waste my memory?
22 months ago
u8
At least use the standard uint8_t
22 months ago
long doubles
not double doubles
Ya blew it.
22 months ago
long long cock = deep_in_ops_ass();
22 months ago
low memory is for double niggers.
22 months ago
Ya done goofed. Double uses the most memory.
22 months ago
user's program conserves memory like a cuck
now chadfox has more memory to leak
22 months ago
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.
22 months ago