<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8641190</id><updated>2011-12-14T19:11:32.502-08:00</updated><title type='text'>Karb0n's blog</title><subtitle type='html'>What crosses my mind</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://karb0noxyde.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8641190/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://karb0noxyde.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>karb0noxyde</name><uri>http://www.blogger.com/profile/18401846599304579287</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8641190.post-110036338103064165</id><published>2004-11-13T08:09:00.000-08:00</published><updated>2004-11-13T08:29:41.030-08:00</updated><title type='text'>Bigint ( II )</title><content type='html'>Another way could be  distributing the bits of the binary number over built-in types ( btw, from now on, I'll focus on C++ ), example:&lt;br /&gt;We have a number 4903662431, which is 100100100010001111111001101011111in binary, and we distribute it over unsigned chars ( 8 bits most of the time ):&lt;br /&gt;&lt;br /&gt;|00000001| |00100100| |01000111| |11110011| |01011111|&lt;br /&gt;|     char 1    |  |   char 2    | |    char 3   | |   char 4   | |   char 5   |&lt;br /&gt;&lt;br /&gt;See, we divide it in chunks of 8 bits going from the right to left.&lt;br /&gt;&lt;br /&gt;Now we can easly add two numbers using less memory, and faster. The process is easy: you take the right most char from a number and the char in that in the same position from the other int and just add them together using the processor, since the result is moduled to the maximum size of the char ( in this case 256 ( 2^8 ) ) we dont have to worry about anything but the remainder. When you add in binary, if the result is bigger than 1 then you add add a 1 to the next digit, so same thing here, but how do we know when something is going to be bigger than 256? one option could be puting the result in a bigger variable, an int for example, but if we want to optimize our bigint to the maximum we'll want to use the biggest variable for adding. Another possibility is algebra, say we have 2 number a and b, and a third number c representing the maximum size, when is a + b &gt;= c ? well easy: a+b &gt;= c =&gt; a &gt;= c-b,  see, here we are not using numbers bigger than c.&lt;br /&gt;&lt;br /&gt;So now that we have adding implemented, we can quickly make the multiplication and substraction, the multiplication of a times b is a summed b times so thats easy. And substraction is just like the sum but changing some minor differences.&lt;br /&gt;&lt;br /&gt;tbc&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8641190-110036338103064165?l=karb0noxyde.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karb0noxyde.blogspot.com/feeds/110036338103064165/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8641190&amp;postID=110036338103064165' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8641190/posts/default/110036338103064165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8641190/posts/default/110036338103064165'/><link rel='alternate' type='text/html' href='http://karb0noxyde.blogspot.com/2004/11/bigint-ii.html' title='Bigint ( II )'/><author><name>karb0noxyde</name><uri>http://www.blogger.com/profile/18401846599304579287</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8641190.post-110018543030783400</id><published>2004-11-11T07:03:00.000-08:00</published><updated>2004-11-11T07:03:50.306-08:00</updated><title type='text'>Bigint Ideas ( I )</title><content type='html'>This is a series of articles about operating with big numbers ( numbers bigger than the maximum size of a built-in type )&lt;br /&gt;&lt;br /&gt;1. The most simple (binary)&lt;br /&gt;A first aproach would be converting both number to binary and implement binary sum. This is quite easy but it could be faster and use less memory.&lt;br /&gt;&lt;br /&gt;tbc&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8641190-110018543030783400?l=karb0noxyde.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karb0noxyde.blogspot.com/feeds/110018543030783400/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8641190&amp;postID=110018543030783400' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8641190/posts/default/110018543030783400'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8641190/posts/default/110018543030783400'/><link rel='alternate' type='text/html' href='http://karb0noxyde.blogspot.com/2004/11/bigint-ideas-i.html' title='Bigint Ideas ( I )'/><author><name>karb0noxyde</name><uri>http://www.blogger.com/profile/18401846599304579287</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8641190.post-109770718869657035</id><published>2004-10-13T15:39:00.000-07:00</published><updated>2004-11-06T16:28:29.806-08:00</updated><title type='text'>Sims 2</title><content type='html'>&lt;a href="http://photos1.blogger.com/img/278/2034/640/snapshot_2dae895f_6db0f4a6.jpg"&gt;&lt;img style="border: 1px solid rgb(0, 0, 0); margin: 2px;" src="http://photos1.blogger.com/img/278/2034/400/snapshot_2dae895f_6db0f4a6.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Cool I just got the Sims 2 =D, lol=P&lt;a href="http://www.hello.com/" target="ext"&gt;&lt;img src="http://photos1.blogger.com/pbh.gif" alt="Posted by Hello" style="border: 0px none ; padding: 0px; background: transparent none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;" align="middle" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8641190-109770718869657035?l=karb0noxyde.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karb0noxyde.blogspot.com/feeds/109770718869657035/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8641190&amp;postID=109770718869657035' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8641190/posts/default/109770718869657035'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8641190/posts/default/109770718869657035'/><link rel='alternate' type='text/html' href='http://karb0noxyde.blogspot.com/2004/10/sims-2.html' title='Sims 2'/><author><name>karb0noxyde</name><uri>http://www.blogger.com/profile/18401846599304579287</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8641190.post-109752971919951610</id><published>2004-10-11T13:40:00.000-07:00</published><updated>2004-10-11T14:32:08.760-07:00</updated><title type='text'>Variable Storing in memory (C++)</title><content type='html'>In C++ you have three places where you can store variables:&lt;br /&gt;&lt;ul&gt;   &lt;li&gt;Register&lt;/li&gt;   &lt;li&gt;Stack&lt;/li&gt;   &lt;li&gt;Heap&lt;/li&gt; &lt;/ul&gt; Each of them have their own advatnages and disadvantages which I'll cover here.&lt;br /&gt;Nowadays the register is not often used (correct me if I'm wrong) , but when you can really use it (at very low level), it's the best place to store small variables that you will use a lot and that need to be fast, that is because the registers are directly managed by the processor, it doesn't have to access the RAM so it's very fast, however, you won't be able to store data that is too big and you have a limited amount of registers.&lt;br /&gt;&lt;br /&gt;When you create a variable in a function and don't add anything else but the type, the variable is stored in the stack (this type of variables are called auto (ex: auto int myint = 0), and is the default for all local variables). Think of the stack as a pile of papers, you can read the top of the pile, you can trash the top of the pile, you can move the top paper and read the next one, etc. So, the stack is relatevly fast and can be used for most things without any problems, and in most cases, it's best way of storing variables, they are created and initialized when the program gets to the function where they're defined and are destroyed when the function ends. However, as everything, it has it's limitations, for example, you can't have too many (or too big) auto variables because you'll overload the stack, which isn't good hehe.&lt;br /&gt;&lt;br /&gt;And finally, heap variables. This variables are stored on plain RAM and thats because they're the slowest (considering the speed of registers and the stack) but the good thing is that you have a lot space (well this depends on the ammount of RAM available). This type of variables are created with the operator &lt;span style="font-style: italic;"&gt;new&lt;/span&gt; and destroyed with &lt;span style="font-style: italic;"&gt;delete &lt;/span&gt;or &lt;span style="font-style: italic;"&gt;free&lt;/span&gt;, they don't die when the function ends which can make memory leaking problems, but it's the best place of storing big variables and actively controlling their lifetime.&lt;br /&gt;&lt;br /&gt;Missuses of the types of variables:&lt;br /&gt;When you make a function that returns a pointer, for example:&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;//-----------------------&lt;br /&gt;char * myfunc( const char some_arg )&lt;br /&gt;{&lt;br /&gt;  char    *    myvar;&lt;br /&gt;&lt;br /&gt;  myvar = "Some string";&lt;br /&gt;  return        myvar;&lt;br /&gt;}&lt;br /&gt;//-----------------------&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;The variable &lt;span style="color: rgb(0, 0, 153);"&gt;myvar &lt;/span&gt;is destroyed at the end of the function so the the pointer will be pointing to a non-existing locations. This might work as expected, my not work or might just exit giving you a memory violating error because you're triying to read protected memory. This is one of the worst errors a programmer can make, because as I said, it might work some times and he/she won't notice it until it becomes a huge problem and has to spend hours debugging the application.&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8641190-109752971919951610?l=karb0noxyde.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karb0noxyde.blogspot.com/feeds/109752971919951610/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8641190&amp;postID=109752971919951610' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8641190/posts/default/109752971919951610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8641190/posts/default/109752971919951610'/><link rel='alternate' type='text/html' href='http://karb0noxyde.blogspot.com/2004/10/variable-storing-in-memory-c.html' title='Variable Storing in memory (C++)'/><author><name>karb0noxyde</name><uri>http://www.blogger.com/profile/18401846599304579287</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8641190.post-109727518640564311</id><published>2004-10-08T15:33:00.000-07:00</published><updated>2004-10-08T15:44:30.726-07:00</updated><title type='text'>TicTacToe</title><content type='html'>Well, I just installed my new Visual Studio .NET and to retake my C++ skills i tried to make a tictactoe game. I wanted to make one cause I never made any AI-related projects. Anyway, i finished it (faster than i thought) today, it doesn't have a nice GUI or anything but that wasn't the purpose, the purpose was to make an inbincible TicTacToe AI player and that worked =D. Lets see if posting images works hehe:&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;[Ok i have to find some image host, i don't really like Hello's system...]&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8641190-109727518640564311?l=karb0noxyde.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karb0noxyde.blogspot.com/feeds/109727518640564311/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8641190&amp;postID=109727518640564311' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8641190/posts/default/109727518640564311'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8641190/posts/default/109727518640564311'/><link rel='alternate' type='text/html' href='http://karb0noxyde.blogspot.com/2004/10/tictactoe.html' title='TicTacToe'/><author><name>karb0noxyde</name><uri>http://www.blogger.com/profile/18401846599304579287</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>
