Skip to content

Commit ce0d0ef

Browse files
authored
Update first.md
Fixed typo (gratly -> greatly)
1 parent debf6e0 commit ce0d0ef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

content/first.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ Those are points where other GBA tutorials often err. It's not an exclusive list
348348
- **Use a better algorithm**. Okay, so this one may not always be simple, but it's still very true.
349349
- **Use ints**. The `int` is loosely defined as the native datatype. Processors tend to perform better when they deal with their native datatype.
350350
- **Use temporary variables for common expressions**. If you use a long expression more than a few times, consider dumping it in a temp. This means less writing for you, and less reading for everyone. It can also make your code faster because you don't need to evaluate the entire expression all the time. This is especially true for global variables, which have to be reloaded after each function-call because the values may have changed.
351-
- **Use pointers**. Pointers have the reputation of being dangerous, but they're a *very* powerful tool if used correctly. Pointer arithmetic is usually faster than indexing because it's closer to hardware, and by assigning temp pointers to deeply nested structure expressions (see above), you can gratly reduce the length of the expressions, which makes things easier on the compiler and the reader alike.
351+
- **Use pointers**. Pointers have the reputation of being dangerous, but they're a *very* powerful tool if used correctly. Pointer arithmetic is usually faster than indexing because it's closer to hardware, and by assigning temp pointers to deeply nested structure expressions (see above), you can greatly reduce the length of the expressions, which makes things easier on the compiler and the reader alike.
352352
- **Precalculate.** This is related to the previous two points. If you have a loop in which things don't depend on the loop-variable, precalculate that part before the loop. Also, to avoid (complex) calculations, you could dump the data in a [Look-up Table](fixed.html#sec-lut) and simply grab a value from there.
353353
- **Avoid branches**. Things that redirect program flow (ifs, loops, switches) generally cost more than other operations such as arithmetic. Sometimes it's possible to effectively do the branch with arithmetic (for example, `(int)x>>1` gives −1 or 0, depending on the sign of *x*)
354354

0 commit comments

Comments
 (0)