Update
This commit is contained in:
parent
49f5a12c8b
commit
2a3266e7b6
13 changed files with 198 additions and 22 deletions
160
bit_hack.md
Normal file
160
bit_hack.md
Normal file
|
@ -0,0 +1,160 @@
|
|||
# Bit Hack
|
||||
|
||||
Bit hacks or bit tricks are simple clever formulas for performing useful operations with [binary](binary.md) numbers. Some operations, such as checking if a number is power of two or reversing bits in a number, can be done very efficiently with these hacks, without using loops, [branching](branchless.md) and other undesirably slow operations, potentially increasing speed and/or decreasing size and/or memory usage of code -- this can help us [optimize](optimization.md). Many of these can be found on the [web](www.md) and there are also books such as *Hacker's Delight* which document such hacks.
|
||||
|
||||
## Specific Bit Hacks
|
||||
|
||||
{ Work in progress. I'm taking these from various sources such as the *Hacker's Delight* book or web and rewriting them a bit, always testing. Some of these are my own. ~drummyfish }
|
||||
|
||||
Unless noted otherwise we suppose [C](c.md) syntax and semantics and integer [data types](data_type.md). Keep in mind all potential dangers, for example it may sometimes be better to write an idiomatic code and let compiler do the optimization that's best for given platform, also of course readability will worsen etc. Nevertheless as a hacker you should know about these tricks, it's useful for low level code etc.
|
||||
|
||||
**2^N**: `1 << N`
|
||||
|
||||
**[absolute value](abs.md) of x ([two's complement](twos_complement.md))**:
|
||||
|
||||
```
|
||||
int t = x >> (sizeof(x) * 8 - 1);
|
||||
x = (x + t) ^ t;
|
||||
```
|
||||
|
||||
**average x and y without overflow**: `(x & y) + ((x ^ y) >> 1)` { TODO: works with unsigned, not sure about signed. ~drummyfish }
|
||||
|
||||
**clear (to 0) Nth bit of x**: `x & ~(1 << N)`
|
||||
|
||||
**clear (to 0) rightmost 1 bit of x**: `x & (x - 1)`
|
||||
|
||||
**conditionally add (subtract etc.) x and y based on condition c (c is 0 or 1)**: `x + ((0 - c) & y)`, this avoids branches AND ALSO multiplication by c, of course you may replace + by another operators.
|
||||
|
||||
**count 0 bits of x**: Count 1 bits and subtract from data type width.
|
||||
|
||||
**count 1 bits of x (8 bit)**: We add neighboring bits in parallel, then neighboring groups of 2 bits, then neighboring groups of 4 bits.
|
||||
|
||||
```
|
||||
x = (x & 0x55) + ((x >> 1) & 0x55);
|
||||
x = (x & 0x33) + ((x >> 2) & 0x33);
|
||||
x = (x & 0x0f) + (x >> 4);
|
||||
```
|
||||
|
||||
**count 1 bits of x (32 bit)**: Analogous to 8 bit version.
|
||||
|
||||
```
|
||||
x = (x & 0x55555555) + ((x >> 1) & 0x55555555);
|
||||
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
|
||||
x = (x & 0x0f0f0f0f) + ((x >> 4) & 0x0f0f0f0f);
|
||||
x = (x & 0x00ff00ff) + ((x >> 8) & 0x00ff00ff);
|
||||
x = (x & 0x0000ffff) + (x >> 16);
|
||||
```
|
||||
|
||||
**count leading 0 bits in x (8 bit)**:
|
||||
|
||||
```
|
||||
int r = (x == 0);
|
||||
if (x <= 0x0f) { r += 4; x <<= 4; }
|
||||
if (x <= 0x3f) { r += 2; x <<= 2; }
|
||||
if (x <= 0x7f) { r += 1; }
|
||||
```
|
||||
|
||||
**count leading 0 bits in x (32 bit)**: Analogous to 8 bit version.
|
||||
|
||||
```
|
||||
int r = (x == 0);
|
||||
if (x <= 0x0000ffff) { r += 16; x <<= 16; }
|
||||
if (x <= 0x00ffffff) { r += 8; x <<= 8; }
|
||||
if (x <= 0x0fffffff) { r += 4; x <<= 4; }
|
||||
if (x <= 0x3fffffff) { r += 2; x <<= 2; }
|
||||
if (x <= 0x7fffffff) { r += 1; }
|
||||
```
|
||||
|
||||
**divide x by 2^N**: `x >> N`
|
||||
|
||||
**divide x by 3 (unsigned at least 16 bit, x < 256)**: `((x + 1) * 85) >> 8`, we use kind of a [fixed point](fixed_point.md) multiplication by reciprocal (1/3), on some platforms this may be faster than using the divide instruction, but not always (also compilers often do this for you). { I checked this particular trick and it gives exact results for any x < 256, however this may generally not be the case for other constants than 3. Still even if not 100% accurate this can be used to approximate division. ~drummyfish }
|
||||
|
||||
**divide x by 5 (unsigned at least 16 bit, x < 256)**: `((x + 1) * 51) >> 8`, analogous to divide by 3.
|
||||
|
||||
**get Nth bit of x**: `(x >> N) & 0x01`
|
||||
|
||||
**is x a power of 2?**: `x && ((x & (x - 1)) == 0)`
|
||||
|
||||
**is x even?**: `(x & 0x01) == 0`
|
||||
|
||||
**is x odd?**: `(x & 0x01)`
|
||||
|
||||
**isolate rightmost 0 bit of x**: `~x & (x + 1)`
|
||||
|
||||
**isolate rightmost 1 bit of x**: `x & (~x + 1)` (in [two's complement](twos_complement.md) equivalent to `x & -x`)
|
||||
|
||||
**log base 2 of x**: Count leading 0 bits, subtract from data type width - 1.
|
||||
|
||||
**maximum of x and y**: `x ^ ((0 - (x < y)) & (x ^ y))`
|
||||
|
||||
**minimum of x and y**: `x ^ ((0 - (x > y)) & (x ^ y))`
|
||||
|
||||
**multiply x by 2^N**: `x << N`
|
||||
|
||||
**multiply by 7 (and other numbers close to 2^N)**: `(x << 3) - x`
|
||||
|
||||
**next higher or equal power of 2 from x (32 bit)**:
|
||||
|
||||
```
|
||||
x--;
|
||||
x |= x >> 1;
|
||||
x |= x >> 2;
|
||||
x |= x >> 4;
|
||||
x |= x >> 8;
|
||||
x |= x >> 16;
|
||||
x = x + 1 + (x == 0);
|
||||
```
|
||||
|
||||
**[parity](parity.md) of x (8 bit)**:
|
||||
|
||||
```
|
||||
x ^= x >> 1;
|
||||
x ^= x >> 2;
|
||||
x = (x ^ (x >> 4)) & 0x01;
|
||||
```
|
||||
|
||||
**reverse bits of x (8 bit)**: We switch neighboring bits, then switch neighboring groups of 2 bits, then neighboring groups of 4 bits.
|
||||
|
||||
```
|
||||
x = ((x >> 1) & 0x55) | ((x & 0x55) << 1);
|
||||
x = ((x >> 2) & 0x33) | ((x & 0x33) << 2);
|
||||
x = ((x >> 4) & 0x0f) | (x << 4);
|
||||
```
|
||||
|
||||
**reverse bits of x (32 bit)**: Analogous to the 8 bit version.
|
||||
|
||||
```
|
||||
x = ((x >> 1) & 0x55555555) | ((x & 0x55555555) << 1);
|
||||
x = ((x >> 2) & 0x33333333) | ((x & 0x33333333) << 2);
|
||||
x = ((x >> 4) & 0x0f0f0f0f) | ((x & 0x0f0f0f0f) << 4);
|
||||
x = ((x >> 8) & 0x00ff00ff) | ((x & 0x00ff00ff) << 8);
|
||||
x = ((x >> 16) & 0x0000ffff) | (x << 16);
|
||||
```
|
||||
|
||||
**rotate x left by N (8 bit)**: `(x << N) | (x >> (8 - N))` (watch out, in C: N < 8, if storing in wider type also do `& 0xff`)
|
||||
|
||||
**rotate x right by N (8 bit)**: analogous to left rotation, `(x >> N) | (x << (8 - N))`
|
||||
|
||||
**set (to 1) Nth bit of x**: `x | (1 << N)`
|
||||
|
||||
**set (to 1) the rightmost 0 bit of x**: `x | (x + 1)`
|
||||
|
||||
**set or clear Nth bit of x to b**: `(x & ~(1 << N)) | (b << N)`
|
||||
|
||||
**sign of x (returns 1, 0 or -1)**: `(x > 0) - (x < 0)`
|
||||
|
||||
**swap x and y (without tmp var.)**: `x ^= y; y ^= x; x ^= y;` or `x -= y; y += x; x = y - x;`
|
||||
|
||||
**toggle Nth bit of x**: `x ^ (1 << N)`
|
||||
|
||||
**toggle x between A and B**: `(x ^ A) ^ B`
|
||||
|
||||
**x and y have different signs?**: `(x > 0) == (y > 0)`, `(x <= 0) == (y <= 0)` etc. (differs on 0:0 behavior)
|
||||
|
||||
TODO: the ugly hacks that use conversion to/from float?
|
||||
|
||||
## See Also
|
||||
|
||||
- [De Morgan's laws](de_morgans_laws.md)
|
||||
- [fast inverse square root](fast_inverse_sqrt.md)
|
||||
- [optimization](optimization.md)
|
|
@ -54,6 +54,7 @@ The following is a list of just SOME attributes of capitalism -- note that not a
|
|||
- **abuse of animals**: In capitalism animals are just products and resources, they are kept in very bad conditions just to be killed for meat or other purpose. They are slaughtered by millions just so we can overeat to morbid obesity. Maximizing profit dictates no money should be spent on animal comfort.
|
||||
- **[productivity cult](productivity_cult.md)**: People are brainwashed and forced into becoming robots whose sole purpose is to produce. Working overtimes, skipping lunch, minimizing sleep etc. has already become part of the work culture for example in USA and Japan.
|
||||
- **everything is fake**: Everything is rotten and corrupted on the inside with an extreme effort towards putting up a misleading good looking facade. TV shows are all staged (even those swearing to be not, no producer is going to invest money in something depending on pure luck), smiles and emotion of people you meet in workplace or see on ads, women's tits, butts and faces, men's muscles, photos on social media, food that has basically no food in it, even news and facts, everything is fake. Investigating any area (government, working conditions, technology, healthcare, education, charities, "[science](soyence.md)", ...) in depth practically always leads to unrevealing how shitty it actually is despite it looking nice and ideal at the first look.
|
||||
- **[rape effect](rape_effect.md)**: The mechanisms of capitalism work in such ways that everyone gets progressively more raped with any further advance of capitalism.
|
||||
- **endangering existence of all life**: The mentioned lack of long term planning, irresponsibility and instability along with creating a dangerous overdependence on technology and interconnections of self insufficient states and cities is just waiting for a disaster such as [CME](cme.md) that immediately collapses the civilization and consequently endangers all life on Earth e.g. by meltdowns in nuclear plants or possible nuclear wars as a consequence of panic. The absolute preference of immediate profit is hostile towards investments in future and precautions.
|
||||
|
||||
## How It Works
|
||||
|
|
7
faq.md
7
faq.md
|
@ -2,8 +2,7 @@
|
|||
|
||||
*Not to be confused with [fuck](fuck.md) or [frequently questioned answers](fqa.md).*
|
||||
|
||||
{ answers by ~drummyfish }
|
||||
|
||||
{ answers by ~[drummyfish](drummyfish.md) }
|
||||
|
||||
### Is this a joke? Are you trolling?
|
||||
|
||||
|
@ -19,6 +18,10 @@ Sometimes these sets may greatly overlap and LRS is at times just a slightly dif
|
|||
|
||||
One way to see LRS is as a philosophy that takes only the [good](good.md) out of existing philosophies/movements/ideologies/etc. and adds them to a single unique [idealist](idealism.md) mix, without including [cancer](cancer.md), [bullshit](bullshit.md), errors, propaganda and other negative phenomena plaguing basically all existing philosophies/movements/ideologies/etc.
|
||||
|
||||
### How is this different from Wikipedia?
|
||||
|
||||
In many ways, our wiki is better e.g. by being more [free](free_culture.md) (completely [public domain](public_domain.md), no [fair use](fair_use.md) [proprietary](proprietary.md) images etc.), less [bloated](bloat.md), better accessible, not infected by [pseudoleftist](psedoleft.md) [fascism](fascism.md) and censorship (we only censor absolutely necessary things, e.g. copyrighted things or things that would immediately put us in jail, though we still say many things that may get us in jail), we have articles that are better readable etc.
|
||||
|
||||
### Why this obsession with extreme simplicity? Is it because you're too stupid to understand complex stuff?
|
||||
|
||||
I used to be the mainstream, complexity embracing programmer. I am in no way saying I'm a genius but I've put a lot of energy into studying computer science full time for many years so I believe I can say I have some understanding of the "complex" stuff. I speak from own experience and also on behalf of others who shared their experience with me that the appreciation of simplicity and realization of its necessity comes after many years of dealing with the complex and deep insight into the field and into the complex connections of that field to society.
|
||||
|
|
|
@ -25,7 +25,7 @@ in our system has to be normalized like this:
|
|||
|
||||
(`000010.00` * `000000.10`) / 4 = `000001.00` (2.0 * 0.5 = 1.0)
|
||||
|
||||
With this normalization we also have to **think about how to bracket expressions** to prevent rounding errors and [overflows](overflow.md), for example instead of `(x / y) * 4` we may want to write `(x * 4) / y`; imagine e.g. *x* being `00000010` (0.5) and *y* being `00000100` (1.0), the former would result in 0 (incorrect, rounding error) while the latter correctly results in 0.5. The bracketing depends on what values you expect to be in the variables so it can't really be done automatically by a compiler or library (well, it might probably be somehow handled at [runtime](runtime.md), but of course, that will be slower).
|
||||
With this normalization we also have to **think about how to bracket expressions to prevent rounding errors and [overflows](overflow.md)**, for example instead of `(x / y) * 4` we may want to write `(x * 4) / y`; imagine e.g. *x* being `00000010` (0.5) and *y* being `00000100` (1.0), the former would result in 0 (incorrect, rounding error) while the latter correctly results in 0.5. The bracketing depends on what values you expect to be in the variables so it can't really be done automatically by a compiler or library (well, it might probably be somehow handled at [runtime](runtime.md), but of course, that will be slower). There are also ways to prevent overflows e.g. with clever [bit hacks](bit_hack.md).
|
||||
|
||||
The normalization is basically the only thing you have to think about, apart from this everything works as with integers. Remember that **this all also works with negative number in [two's complement](twos_complement.md)**, so you can use a signed integer type without any extra trouble.
|
||||
|
||||
|
|
2
jokes.md
2
jokes.md
|
@ -2,7 +2,7 @@
|
|||
|
||||
Here you can shitpost your jokes that are somehow related to this wiki's topic. Just watch out for [copyright](copyright.md) (no copy-pasting jokes from other sites)!
|
||||
|
||||
Please do NOT post lame "big-bang-theory" jokes like *sudo make sandwich* or *there are 10 types of people*.
|
||||
Please do NOT post lame "big-bang-theory"/[9gag](9gag.md) jokes like *sudo make sandwich* or *there are 10 types of people*.
|
||||
|
||||
{ Many of the jokes are original, some are shamelessly pulled from other sites and reworded. I don't believe [copyright](copyright.md) can apply if the expression of a joke is different, ideas can't be copyrighted. Also the exact origins of jokes are difficult to track so it's probably a kind of folklore. ~drummyfish }
|
||||
|
||||
|
|
|
@ -54,11 +54,11 @@ Our society is **[anarcho pacifist](anpac.md) and [communist](communism.md)**, m
|
|||
- **How is this different from "communism", "socialism" and other movements/ideologies that brought so much suffering and eventually failed anyway?** We are very different especially by NOT advocating revolutions, violence and forceful application of our ideas, we simply educate, show what's wrong and what the solution is. Harm has only ever been done by forcing specific ideas, no matter whether rightist or leftist ones -- the key in preventing harm is to avoid the temptation of forcing ideas. We know that only a voluntary, non-violent change based on facts and rational thinking can succeed in long term. The mistake of every failed "utopian" ideology was that it was forced, oppressive and in the end served only a few as opposed to everyone, no matter what the initial idea was. These ideologies fought other ideologies, creates cults of personalities and propaganda to manipulate masses. We do not fight anyone, we simply show the truth and offer it to people and believe that this truth can't be unseen. Once enough people see the truth and know what the logical solution is, a change will happen naturally, peacefully and inevitably, without any force.
|
||||
- **Isn't your society unnatural?** In many way yes, it's unnatural just as clothes, medicine, computers or humans living over 70 years are unnatural. Civilization by definition means resisting the cruelness of nature, however our proposed society is to live as much as possible in harmony with the nature and is much more natural than our current society which e.g. pushes sleep deprivation, high consumption of antidepressants, eating disorders, addiction to social networks and so on.
|
||||
- **Won't people get bored? What will motivate people? If they have everything why would they even get out of bed? Haven't you seen the mouse utopia experiments?** It is a mistake to think that competition and the necessity of making living is the only or even the main driving force of human behavior and creativity (on the contrary, it is usually what makes people commit suicides, i.e. lose the will to live). Human curiosity, playfulness, the joy of collaboration, boredom, sense of altruism, socialization, seeking of life meaning and recognition and many other forces drive our behavior. Ask yourself: why do people have hobbies when no one is forcing them to it? Why don't you bore yourself to death in your spare time? Why don't rich people who literally don't have to work bore themselves to death? Why doesn't your pet dog that's not forced to hunt for food bore himself to death? Maslow's hierarchy of needs tells us that once people fulfill basic needs such as that for obtaining food, they naturally start to pursue higher ones such as that for socializing or doing science or art. Unlike rats in small cages people show interests in seeking satisfaction of higher needs than just food and sex, even those that aren't scientist try to do things such as sports, photography, woodwork or gardening, just for the sake of it. It's not that there would be a lack challenges in our society, just that we wouldn't force arbitrary challenges on people.
|
||||
- **If you say it's possible, why wasn't it done before?** Firstly small scale communities working on anarchist and peaceful principles have existed for a long time in environments that allow it, e.g. those that have abundance of resources. Globally society couldn't reach this state because only until recently we lacked the technology to provide such an ideal environment globally, i.e. only until recently we have been forced by the nature to compete for basic resources such as food and space to live. However with computers, factories, high level of automation and other technology and knowledge we posses, we now have, for the first time in history, the capability to establish an environment with abundance of resources for everyone. Nowadays only social inertia in the form of [capitalism](capitalism.md) is ARTIFICIALLY keeping scarcity and social competition in place -- getting rid of this obsolete system is now needed to allow establishment of our ideal society.
|
||||
- **How will you make people work?** We won't, in an ideal society people don't need to work, all work is done by machines -- that's the point of creating machines in the first place. In practice there may in a foreseeable future be the need for small amounts of human work such as overlooking the machines, but the amount of work can be so small that volunteers will easily handle it -- especially with people having no burden of working day jobs there should be no shortage of volunteers. Remember that by abandoning the current system 99% of "bullshit work" (marketing, lawyers, bureaucracy, fashion, ...) will disappear.
|
||||
- **Does elimination of bullshit jobs mean my favorite activity will disappear?!** Unless your hobby is something like killing people for fun, we don't aim to force anyone quitting anything he likes to do, on the contrary we aim exactly to establish the freedom to do anything one desires. So if you like e.g. designing clothes, you are free to do so as a form of art, we just argue against e.g. socially forced necessity to follow fashion in clothing and making capitalist business out of it, which is what we call "bullshit". We believe most bullshit activities that were invented by capitalism, such as marketing, will simply naturally disappear once capitalism ends, there is no need to force it.
|
||||
- **How will society make progress?** Just as it always had: by science, curiosity, necessity etc.
|
||||
- **How do you prevent natural human selfish and violent behavior?** Violent and selfish behavior is natural in us just as peaceful and altruistic behavior, we have two sides and which one shows is mostly determined by the conditions in which we live. Nowadays we think people are extremely selfish and violent because we live in society that highly fuels the "evil" side in us, when we're forced to fight for basic living and grow up in a highly competitive environment, it's no surprise most adapt to this and grow up being "dicks". If we're forced to fight for food and brainwashed since birth that "life is a fight", we will be selfish and violent, just as wild wolves are violent while pet dogs whose needs are secured and who were raised peacefully are mostly completely peaceful. If we have abundance and grow up in a society that naturally rejects any violence, we will grow up to solve conflicts peacefully and think of others, just as nowadays we e.g. naturally learn to wear clothes because simply everyone does it and there is little reason not to. If we make resources abundant, there will be no need for selfishness -- do you see anyone stealing air from others out of selfishness? No, because there is no need for it, air is abundant. By changing the environment people live and grow up in we will make 99.99% of people abandon violence and selfish interests (note the remaining natural need for selfishness and competition can be satisfied e.g. with games).
|
||||
- **If you say it's possible, why wasn't it done before?** Firstly small scale communities working on anarchist and peaceful principles have existed for a long time in environments that allow it, e.g. those that have abundance of resources. Globally society couldn't reach this state because only until recently we lacked the technology to provide such an ideal environment globally or even on a scale of a whole country, i.e. only until recently we have been forced by the nature to compete for basic resources such as food and space to live. However with computers, factories, high level of automation and other technology and knowledge we posses, we now have, for the first time in history, the capability to establish an environment with abundance of resources for everyone on the planet. Nowadays only social inertia in the form of [capitalism](capitalism.md) is ARTIFICIALLY keeping scarcity and social competition in place -- getting rid of this obsolete system is now needed to allow establishment of our ideal society. Part of the answer to this question may also be that reaching such an advanced state of society requires long development, technological, cultural and intellectual, just as many other things (things like abolishment of death sentence or even accepting the existence of irrational numbers all required a long time of cultural development).
|
||||
- **How will you make people work?** We won't, in an ideal society people don't have to work, all work is done by machines -- that's the point of creating machines in the first place. In practice there may in a foreseeable future be the need for small amounts of human work such as overlooking the machines, but the amount of work can be so small that volunteers will easily handle it -- especially with people having no burden of working day jobs there should be no shortage of volunteers. Remember that by abandoning the current system 99% of "bullshit work" (marketing, lawyers, bureaucracy, fashion, ...) will disappear.
|
||||
- **Does elimination of bullshit jobs mean my favorite activity will disappear?!** Unless your hobby is something like killing people for fun, we don't aim to force anyone quitting anything he likes to do, on the contrary we aim exactly to establish the freedom to do anything one desires. So if you like e.g. designing clothes, you are free to do so as a form of art, we just argue against e.g. socially forced necessity to follow fashion in clothing and making capitalist business out of it, which is what we call "bullshit". We believe most bullshit activities that were invented by capitalism, such as marketing, will simply naturally disappear once capitalism ends -- there is no need to force disappearance of something that dies out naturally.
|
||||
- **How will society make progress?** Just as it always had: by science, curiosity, necessity, accidental discoveries, pursuit of creating art etc.
|
||||
- **How do you prevent natural human selfish and violent behavior?** Violent and selfish behavior is natural in us just as peaceful and altruistic behavior, we have two sides and which one shows is mostly determined by the conditions in which we live, by our upbringing and people we see as role models. Nowadays we think people are extremely selfish and violent because we live in society that highly fuels the "evil" side in us, when we're forced to fight for basic living and grow up in a highly competitive environment, it's no surprise most adapt to this and grow up to be "dicks". If we're forced to fight for food and brainwashed since birth that "life is a [fight](fight_culture.md)", we will be selfish and violent, just as wild wolves are violent while pet dogs whose needs are secured and who were raised peacefully are mostly completely peaceful. If we have abundance and grow up in a society that naturally rejects any violence, we will grow up to solve conflicts peacefully and think of others, just as nowadays we e.g. naturally learn to wear clothes because simply everyone does it and there is little reason not to. If we make resources abundant, there will be no need for selfishness -- do you see anyone stealing air from others out of selfishness? No, because there is no need for it, air is abundant. By changing the environment people live and grow up in we will make 99.99% of people abandon violence and selfish interests (note the remaining natural need for selfishness and competition can be satisfied e.g. with games).
|
||||
- **How will you prevent chaos without laws or rules for the people?** We don't say there should be no rules, we are just against complicated written law that no one can even comprehend (even lawyers don't know all laws nowadays) and that has so little in common with morality. Our society works on the basis of moral rules that all stem from the common goal of well being of living beings and that are derived and taught by people themselves -- for example one moral rule that all people would learn would be that money is bad for society (along with the reasons why it is so) and even though there would be no police "enforcing" this rule, the rule would be effective by the fact that absolute majority of people would simply refuse to use money -- in a society where most people know capitalism is bad for them capitalism can't work. Note the importance of the fact that people wouldn't just be taught to memorize such rules as "facts set in stone" (as is our current law), emphasis would be put on people deriving their moral code and understanding how their behavior affects others, people would learn and teach by example.
|
||||
- **How will you prevent criminality such as stealing, murder and mafia organizations?** In a society with abundance for all which works for the good of all criminality simply won't make sense, i.e. we will eliminate criminality by solving the root cause of it, not by curing the symptoms (building prisons etc.). People have no reason to revolt against a system that benefits them or attack other people if there is no conflict between them. Large criminal organizations also cannot exist if most population rejects them, for example there cannot arise a capitalist corporation (or a similar mafia organization) if most population is educated and refuses to engage in capitalism. In addition to this a more mature, educated and responsible society will naturally minimize genetic predisposition to things such as aggressivity and self interest by natural selection as females will choose to rather have offspring with good people (unlike today), making genes associated with bad behavior go extinct. Of course, we probably won't eliminate criminality 100%, but that's not possible under any other system -- even in your current society with prisons and other punishments there still exist criminality. Of course in practice, until we achieve our ideal, we will likely need to keep some anti-criminality precautions as a necessary evil, but generally we will be able to greatly relax them (reduce police numbers, abandon death penalty, ...) as we move towards the ideal society. For example in an intermediate state of our society dangerous criminals won't be killed but only immobilized and they won't be put in prisons as a punishment but only sent to e.g. a remote island so as to be isolated, without punishing them by restricting their freedom within the island.
|
||||
- **How will the [economy](economy.md) work without money?** With abundance of resources there will be no money and no trade, resources will be available to anyone who needs them. Various [anarchist](anarchism.md) schools already have proposals for how distribution of resources could work. The [Venus Project](venus_project.md) calls this a [resource based economy](resource_based_economy.md) and proposes using computers and globally placed sensors to collect data and make decisions about where to distribute resources. Resources would be gathered and distributed more locally and cities would be more self sufficient so as to prevent waste and vulnerability of the system, we wouldn't see a huge globalization like nowadays, there is e.g. no need for transporting exotic food all over the whole world to places where there is enough local food available, however anything could be distributed to places where such resources are scarce (e.g. water to deserts). Each community could have food banks and other storage and distribution centers.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
*No gain, no pain.*
|
||||
|
||||
Technological minimalism is a philosophy of designing technology to be as simple as possible while still achieving given goal. Minimalism is one of the most (if not the most) important concepts in [programming](programming.md) and technology in general.
|
||||
Technological minimalism is a philosophy of designing technology to be as simple as possible while still achieving given goal, possibly even a little bit simpler. Minimalism is one of the most (if not the most) important concepts in [programming](programming.md) and technology in general.
|
||||
|
||||
Antoine de Saint-Exupéry sums it by with a quote: *we achieve perfection not when there is nothing more to add, but when there is nothing left to take away.*
|
||||
|
||||
|
|
|
@ -20,9 +20,10 @@ These are mainly for [C](c.md), but may be usable in other languages as well.
|
|||
- **You can use good-enough [approximations](approximation.md) instead of completely accurate calculations**, e.g. taxicab distance instead of Euclidean distance, and gain speed or memory without trading.
|
||||
- **Use quick opt-out conditions**: many times before performing some expensive calculation you can quickly check whether it's even worth performing it and potentially skip it. For example in physics [collision detections](collision_detection.md) you may first quickly check whether the bounding spheres of the bodies collide before running an expensive precise collision detection -- if bounding spheres of objects don't collide, it is not possible for the bodies to collide and so we can skip further collision detection.
|
||||
- **Operations on static data can be accelerated with accelerating structures** ([look-up tables](lut.md) for functions, [indices](indexing.md) for database lookups, spatial grids for collision checking, ...).
|
||||
- **Use powers of 2** whenever possible, this is efficient thanks to computers working in binary. Not only may this help nice utilization and alignment of memory, but mainly multiplication and division can be optimized by the compiler to mere bit shifts which is a tremendous speedup.
|
||||
- **Use powers of 2** (1, 2, 4, 8, 16, 32, ...) whenever possible, this is efficient thanks to computers working in binary. Not only may this help nice utilization and alignment of memory, but mainly multiplication and division can be optimized by the compiler to mere bit shifts which is a tremendous speedup.
|
||||
- **Write [cache-friendly](cache-friendly.md) code** (minimize long jumps in memory).
|
||||
- **Compare to [0](zero.md) rather than other values**. There's usually an instruction that just checks the zero flag which is faster than loading and comparing two arbitrary numbers.
|
||||
- **Use [bit tricks](bit_hack.md)**, hacks for manipulating binary numbers in clever ways only using very basic operations without which one might naively write complex inefficient code with loops and branches. Example of a simple bit trick is checking if a number is power of two as `!(x & (x - 1)) && x`.
|
||||
- **Consider moving computation from run time to compile time**. E.g. if you make a resolution of your game constant (as opposed to a variable), the compiler will be able to partially precompute expressions with the display dimensions and so speed up your program (but you won't be able to dynamically change resolution).
|
||||
- On some platforms such as [ARM](arm.md) the first **arguments to a function may be passed via registers**, so it may be better to have fewer parameters in functions.
|
||||
- **Optimize when you already have a working code**. As [Donald Knuth](knuth.md) put it: "premature optimization is the root of all evil". Nevertheless you should get used to simple nobrainer efficient patterns by default and just write them automatically.
|
||||
|
@ -45,4 +46,8 @@ Nubs often ask this and this can also be a very nontrivial question. Generally f
|
|||
|
||||
The highest-level optimization is done as part of the initial design of the program, before any line of code gets written. This includes the choice of data structures and mathematical models you're going to be using, the very foundation around which you'll be building your castle. This happens in your head at the time you're forming an idea for a program, e.g. you're choosing between [server-client](server_client.md) or [P2P](p2p.md), [monolithic or micro kernel](kernel.md), [raytraced](ray_tracing.md) or [rasterized](rasterization.md) graphics etc. These choices affect greatly the performance of your program but can hardly be changed once the program is completed, so they need to be made beforehand. **This requires wide knowledge and experience** as you work by intuition.
|
||||
|
||||
Another kind of optimization done during development is just automatically writing good code, i.e. being familiar with specific patterns and using them without much thought. For example if you're computing some value inside a loop and this value doesn't change between iterations, you just automatically put computation of that value **before** the loop. Without this you'd simply end up with a shitty code that would have to be rewritten line by line at the end. Yes, compilers can often do this simple kind of optimization for you, but you don't want to rely on it.
|
||||
Another kind of optimization done during development is just automatically writing good code, i.e. being familiar with specific patterns and using them without much thought. For example if you're computing some value inside a loop and this value doesn't change between iterations, you just automatically put computation of that value **before** the loop. Without this you'd simply end up with a shitty code that would have to be rewritten line by line at the end. Yes, compilers can often do this simple kind of optimization for you, but you don't want to rely on it.
|
||||
|
||||
## See Also
|
||||
|
||||
- [bit hacks](bit_hack.md)
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
*"People are retarded."* --[Osho](osho.md)
|
||||
|
||||
Here is a list of people notable in technology (and drummyfish :]).
|
||||
Here is a list of people notable in technology or otherwise (and drummyfish :]).
|
||||
|
||||
- **[Alan Turing](turing.md)**: mathematician, father of [computer science](compsci.md), [gay](gay.md)
|
||||
- **[Alexandre Oliva](alexandre_oliva.md)**: [free software](free_software.md) advocate, founding member of [FSFLA](fsfla.md), maintainer of [Linux-libre](linux_libre.md)
|
||||
|
|
|
@ -8,8 +8,8 @@ The console was created by Jonne Valola from Finland. He started the project on
|
|||
|
||||
Pokito, unlike most other open consoles, is NOT based on [Arduino](arduino.md), but on [NXP](nxp.md)'s LPC11U6x [microcontroller](mcu.md) (MCU). Some features and specs of Pokitto are:
|
||||
|
||||
- Up to **220x176 color display** ([TFT](tft.md)). (Resolution and color depth depends on chosen mode and how much [RAM](ram.md) you want to dedicate to [screen buffer](screen_buffer.md)).
|
||||
- Up to **72 MHz [ARM](arm.md) CPU**. The base frequency is 48 MHz but the hardware is easily [overclocked](overclocking.md).
|
||||
- Up to **220x176 color [TFT](tft.md) display** (ST7775R). (Resolution and color depth depends on chosen mode and how much [RAM](ram.md) you want to dedicate to [screen buffer](screen_buffer.md)).
|
||||
- Up to **72 MHz [ARM](arm.md) CPU** (LPC11U6x). The base frequency is 48 MHz but the hardware is easily [overclocked](overclocking.md).
|
||||
- **256 kB [ROM](rom.md)** (program storage space).
|
||||
- **36 kB [RAM](ram.md)** (working memory).
|
||||
- **4 kB [EEPROM](eeprom.md)** (persistent storage).
|
||||
|
@ -24,4 +24,6 @@ Pokito, unlike most other open consoles, is NOT based on [Arduino](arduino.md),
|
|||
- Schematics and 3D print files available.
|
||||
- A huge number of games and other software has already been written.
|
||||
|
||||
**How [free](free_software.md) is Pokitto?** Quite freedom friendly, but not nearly 100% free; It is made out of [proprietary](proprietary.md) hardware, but it's quite [KISS](kiss.md), the Pokitto library, emulator and most tools as well as many games are [FOSS](foss.md), however the library contains a few proprietary pieces of code (short vendor source code without license), though these are almost certainly not harmful and could easily be replaced. Schematics and printable STL files are available, though license seems to be non-present. No Pokitto trademarks were surprisingly found during brief search.
|
||||
|
||||
Downsides of Pokitto are that the community is an [open source](open_source.md) community rather than [free software](free_software.md) one, purists like us will find they lean towards [bloated](bloat.md) solutions even though the technical limitation of the console largely prevent their implementation. The web forums runs on [discourse](discourse.md) and requires [JavaScript](js.md) for interactivity. [Discord](discord.md) is also actively used for communication, even though some community members bridged it to free alternatives. The official library is relatively bloated and even contains some small pieces of unlicensed code from the MCU manufacturer -- they are very simple assembly snippets that may be easily replacaeble, but we should be cautious even about this. Anyway, a reasonably dedicated programmer might create a suckless Pokitto library without greater problems.
|
|
@ -1,5 +1,9 @@
|
|||
# Proprietary Software
|
||||
|
||||
Proprietary software is any software that is not [free (as in freedom)](free_software.md)/[open source](open_source.md) software. Such software denies users and creators their basic freedoms (freedom of unlimited use, studying, modifying and sharing) and is therefore considered [evil](evil.md), in fact it is mostly [capitalist software](capitalist_software.md) designed to abuse its user in some way. Examples of proprietary software are [MS Windows](windows.md), [MacOS](macos.md), [Adobe Photoshop](photoshop.md) and almost every [game](game.md).
|
||||
Proprietary software is any software that is not [free (as in freedom)](free_software.md)/[open source](open_source.md) software. Such software denies users and creators their basic freedoms (freedom of unlimited use, studying, modifying and sharing) and is therefore [evil](evil.md); proprietary software is mostly [capitalist software](capitalist_software.md) designed to abuse its user in some way. Proprietary code is often secret, not publicly accessible, but there are many programs whose source code is [available](source_available.md) but which is still proprietary because no one except the "owner" has any legal rights to fixing it, improving it or redistributing it.
|
||||
|
||||
Proprietary software licenses are usually called [EULAs](eula.md).
|
||||
Examples of proprietary software are [MS Windows](windows.md), [MacOS](macos.md), [Adobe Photoshop](photoshop.md) and almost every [game](game.md). Proprietary software is not only extremely [harmful](harmful.md) to culture, progress and society in general, it is downright dangerous and in some cases life-threatening; see for example cases of medical implants such as pacemakers running secret proprietary code whose creator and maintainer goes bankrupt and can no longer continue to maintain such devices already planted into bodies of people -- such cases have already appeared, see e.g. *Autonomic Technologies* nervous system implants.
|
||||
|
||||
Proprietary software licenses are usually called [EULAs](eula.md).
|
||||
|
||||
By extension besides proprietary software there also exist other proprietary works, for example proprietary [art](art.md) or databases -- these are all works that are not [free cultural works](free_culture.md). Even though for example a proprietary movie probably isn't IMMEDIATELY as dangerous as proprietary software, it may be just as dangerous to society in the long run.
|
4
rms.md
4
rms.md
|
@ -1,6 +1,6 @@
|
|||
# Richard Stallman
|
||||
|
||||
The great doctor Richard Matthew Stallman (RMS, also [GNU](gnu.md)/Stallman, born 1953 in New York) is one of the biggest figures in software [history](history.md), inventor of [free software](free_software.md), founder of the [GNU project](gnu.md), [Free Software Foundation](fsf.md), a great [hacker](hacking.md) and the author of a famous text editor [Emacs](emacs.md). He is a non-religious [Jew](jew.md), a man who firmly stands behind his beliefs and who's been advocating for ethics and user freedom in the computing world.
|
||||
The great doctor Richard Matthew Stallman (RMS, also [GNU](gnu.md)/Stallman and saint IGNUcius, born 1953 in New York) is one of the biggest figures in software [history](history.md), inventor of [free software](free_software.md), founder of the [GNU project](gnu.md), [Free Software Foundation](fsf.md), a great [hacker](hacking.md) and the author of a famous text editor [Emacs](emacs.md). He is a non-religious [Jew](jew.md) and an [atheist](atheism.md) (though he is the highest saint of [Church Of Emacs](church_of_emacs.md)), a man who firmly stands behind his beliefs and who's been advocating for ethics and user freedom in the computing world.
|
||||
|
||||
```
|
||||
_..._
|
||||
|
@ -17,7 +17,7 @@ Stallman's life along with free software's history is documented by a free-licen
|
|||
|
||||
[tl;dr](tldr.md): At 27 as an employee at [MIT](mit.md) AI labs Stallman had a bad experience when trying to fix a Xerox printer who's [proprietary](proprietary.md) software source code was made inaccessible; he also started spotting the betrayal of hacker principles by others who decided to write proprietary software -- he realized proprietary software was inherently wrong as it prevented studying, improvement and sharing of software and enable abuse of users. From 1982 he was involved in a "fight" against the Symbolics company that pushed aggressive proprietary software; he was rewriting their software from scratch to allow Lisp Machine users more freedom -- here he proved his superior programming skills as he was keeping up with the whole team of Symbolics programmers. By 1983 his frustration reached its peak and he announced his [GNU](gnu.md) project on the [Usenet](usenet.md) -- this was a project to create a completely [free as in freedom](free_software.md) [operating system](os.md), an alternative to the proprietary [Unix](unix.md) system that would offer its users freedom to use, study, modify and share the whole software, in the hacker spirit. He followed by publishing a manifesto and establishing the [Free Software Foundation](fsf.md). GNU and FSF popularized and standardized the term [free (as in freedom) software](free_software.md), [copyleft](copyleft.md) and free licensing, e.g. with the [GPL](gpl.md) license. In the 90s GNU adopted the [Linux](linux.md) operating system kernel and released a complete version of the GNU operating system -- these are nowadays known mostly as "Linux" [distros](distro.md). For the whole time Stallman has been traveling around the world and giving talks about free software and has earned his status of one of the most important people in software history.
|
||||
|
||||
Regarding [software](software.md) Stallman has for his whole life strongly and tirelessly promoted free software and [copyleft](copyleft.md) and has himself only used such software; he has always practiced what he preched and led the best example of how to live without [proprietary](proprietary.md) software. This is amazing. Nevertheless he isn't too concerned about [bloat](bloat.md) (judging by the GNU software and his own creation, [emacs](emacs.md)) and he also doesn't care that much about [free culture](free_culture.md) (some of his written works prohibit modification and his GNU project allows proprietary non-functional data). Sadly he has also shown signs of being a [type A fail](fail_ab.md) personality by writing about some kind of newspeak "*gender neutral language*" and by seeming to be caught in a [fight culture](fight_culture.md) (e.g. by supporting copyleft). Nevertheless he definitely can't be accused of populism as he basically tells what he considers to be the truth no matter what, and he is very consistent in this. Some of his unpopular opinions brought him a lot of trouble, e.g. the wrath of [SJWs](sjw.md) in 2019 for his criticism of the [pedo](pedophile.md) witch hunt.
|
||||
Regarding [software](software.md) Stallman has for his whole life strongly and tirelessly promoted free software and [copyleft](copyleft.md) and has himself only used free software; he has always practiced what he preched and led the best example of how to live without [proprietary](proprietary.md) software. This is amazing. Nevertheless he isn't too concerned about [bloat](bloat.md) (judging by the GNU software and his own creation, [Emacs](emacs.md)) and he also doesn't care that much about [free culture](free_culture.md) (some of his written works prohibit modification and his GNU project allows proprietary non-functional data). Sadly he has also shown signs of being a [type A fail](fail_ab.md) personality by writing about some kind of [newspeak](newspeak.md) "*gender neutral language*" and by seeming to be caught in a [fight culture](fight_culture.md). Nevertheless he definitely can't be accused of populism or hypocrisy as he basically tells what he considers to be the truth no matter what, and he is very consistent in this. Some of his unpopular opinions brought him a lot of trouble, e.g. the wrath of [SJWs](sjw.md) in 2019 for his criticism of the [pedo](pedophile.md) witch hunt.
|
||||
|
||||
He is a weird guy, having been recorded on video eating dirt from his feet before giving a lecture. In the book *Free as in Freedom* he admits he might be slightly [autistic](autism.md). Nevertheless he's pretty smart, has magna cum laude degree in [physics](physics.md) from Harvard, 10+ honorary doctorates, fluently speaks English, Spanish and French and a little bit of Indonesian and has many times proven his superior programming skills (even though he later stopped programming to fully work on promoting the FSF).
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ If you contribute, add yourself to [wiki authors](wiki_authors.md)! You can also
|
|||
|
||||
1. **Everything is [public domain](public_domain.md)** under [CC0](cc0.md) to which all contributors agree. No one owns what we write here.
|
||||
2. **No [fair use](fair_use.md)** or even unfrair use. We want this Wiki to be as free as possible and don't thread the fine legal lines. That means you can't directly include anything on this Wiki if it's copyrighted, **even if it's under a free license**. So generally **avoid any copy pasting and rather try to write everything yourself**.
|
||||
3. **No unnecessary [censorship](censorship.md)**. Necessary censorship basically only includes spam, shitty content, [IP](intellectual_property.md)-infected content (content that would make this wiki not be in public domain) and hardcore illegal stuff that would put us in jail. Controversial/incorrect/taboo content etc. is NOT to be censored.
|
||||
3. **No unnecessary [censorship](censorship.md)**. Necessary censorship basically only includes spam, shitty content, [IP](intellectual_property.md)-infected content (content that would make this wiki not be in public domain) and hardcore illegal stuff that would immediately put us in jail. However spreading truth mustn't be hurt by fear of jail. Controversial/incorrect/taboo content etc. is NOT to be censored.
|
||||
|
||||
## Style
|
||||
|
||||
|
@ -21,8 +21,9 @@ If you contribute, add yourself to [wiki authors](wiki_authors.md)! You can also
|
|||
- **This isn't [Wikipedia](wikipedia.md)**, memes, opinions and uncensored truths are allowed (and welcome).
|
||||
- The style of this wiki is inspired by the classic hacker culture works such as the [WikiWikiWeb](wikiwikiweb.md) and [Jargon File](jargon_file.md).
|
||||
- **Writing style should be relaxed and in many parts informal**. Formality is used where it is useful (e.g. definitions), most of other text can benefit from being written as a tech conversation among friends.
|
||||
- **Political incorectness, slurs and "offensive speech" is highly encouraged**.
|
||||
- **Images**: for now don't embed images. [ASCII art](ascii_art.md) can be used in many places instead of an image. Thousand words are worth a picture. Non-embedding links to images are okay.
|
||||
- **Depth/complexity/level of articles**: Articles shouldn't try to go to unnecessary depth, but also shouldn't be shallow. This is written mainly for programmers of [less retarded society](less_retarded_society.md), the complexity should follow from that. Again, start simple and go more into depth later on in the article, very complex things should rather be explained intuitively, no need for complex proofs etc.
|
||||
- **Political incorectness, slurs and "offensive speech" is highly encouraged**. Of course this is not to "offend" anyone, this helps people unlearn being offended.
|
||||
- **Images**: for now don't embed images. [ASCII art](ascii_art.md) can be used in many places instead of an image. Thousand words are worth a picture. Non-embedding links to images may be okay.
|
||||
- **You can leave comments right in the text of articles**, e.g. like this: { I disagree with this [shit](shit.md). ~drummyfish }.
|
||||
|
||||
Articles should be written to be somewhat readable and understandable to tech savvy people who already know something about technology, i.e. not only experts (as is sometimes the case e.g. on Wikipedia). **Each article should ideally start with a general dictionary [definition](definition.md)** and continue with a simple general explanation and overview of the topic. With more paragraphs the text can get more complex. The idea is that a noob will read the first paragraph, understand the basic idea and take something away. A more advanced reader will read further on and take away more things etc. I.e. we educate in a top-down approach.
|
||||
|
|
Loading…
Reference in a new issue