Update
This commit is contained in:
parent
bb3a0d81d6
commit
1ccdf27364
8 changed files with 112 additions and 11 deletions
|
@ -52,6 +52,7 @@ A great many commonly used tricks in programming could be regarded as hacks even
|
|||
- **[bit hacks](bit_hack.md)**: Clever manipulations of [bits](bit.md) -- for example it is possible to swap two variable without a temporary variables by using the [xor](xor.md) function. Another simplest example is implementing division by 2 as binary shift by 1 (this hack is used in real life by people for quickly dividing by 10, we just remove the last digit).
|
||||
- **[copyleft](copyleft.md)**: A legal hack by [Richard Stallman](rms.md), connected to [free software](free_software.md), working on the basis of the following idea: "If [copyright](copyright.md) lets me put any conditions on my work, I may impose a condition on my work that says that any modified version must not impose any restrictive conditions".
|
||||
- **[fast inverse square root](fast_inverse_sqrt.md)**: Famous hack that was used in the [game](game.md) Quake, it [approxmates](approximation.md) a [square root](sqrt.md) of a [floating point](float.md) number by treating it as an integer and bashing it with a [magic constant](magic_constant.md), which is about four times faster than computing the value with the obvious floating point division.
|
||||
- **Memory [rape](rape.md) in [C](c.md)**: E.g. instead of doing proper memory allocation with potentially inefficient and bloated `malloc` one may try to do a custom memory allocation without any libraries by abusing allocation on stack -- allocate a variable size array in main, set some global pointer to it and then manage this chunk of memory with your own allocation functions.
|
||||
- **[game of life](game_of_life.md) patterns**: Stable patterns such as glider or even programming game of life in game of life is a nice example of game hacking -- in fact exactly game of life hacking stood at the beginning of hacker culture.
|
||||
- **[bytebeat](bytebeat.md)**: A [demoscene](demoscene.md) hack that utilizes integer [overflows](overflow.md) to create rhythm and produce music.
|
||||
- Computer [graphics](graphics.md) uses many clever tricks that could possibly be called hacks, e.g. in times when 3D graphics was primitive and didn't allow achieving such effects as mirror reflections easily, some [games](game.md) faked mirrors simply with a hole in the wall behind which the whole mirrored room was placed -- this achieved the same effect as a mirror and didn't require any extra rendering passes or shaders.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue