#101
Posted 15 December 2013 - 02:47 PM
#102
Posted 15 December 2013 - 02:57 PM
Lyqyd, on 15 December 2013 - 02:47 PM, said:
Edit: So like you would have "512 512 512 8 1 " rather than "fffab23"
Edited by Symmetryc, 15 December 2013 - 03:42 PM.
#103
Posted 15 December 2013 - 03:43 PM
#104
Posted 15 December 2013 - 04:51 PM
Lyqyd, on 15 December 2013 - 03:43 PM, said:
#105
Posted 23 December 2013 - 04:33 AM
Symmetryc, on 15 December 2013 - 02:57 PM, said:
Edit: So like you would have "512 512 512 8 1 " rather than "fffab23"
Raising something to a power is easy for a computer. It's just a simple bit shift, which is probably one of the quickest function a computer could perform. You do need a basic understanding of binary to get this though. Tonnes of stuff on the web for that.
Say you want to raise 2 to the power of 8:
2 in binary is 0010. When you perform a bit shift, all you're doing is moving all the 1s in the binary number to the left a certain number of places. So if we do a bit shift of 1 on the number 2, we get 0100 (see how the 1 moved 1 place to the left?), which in decimal happens to be 4. A bit shift of 2 results in 1000, which happens to be 8. Bit shift of 3 is 0001 0000, which is 16, 0010 0000 is 64, 0100 0000 is 128. See the pattern? So to raise 2 to the power of 8, we just perform a bit shift of 7, giving us 0001 0000 0000, or 256. You can use a bit shift in CC Lua using the bit API. Just bit.blshift(2, 7) (which gives 256) or bit.brshift(256, 7) (which gives 2) for left and right shifts respectively.
Edited by GravityScore, 23 December 2013 - 01:04 PM.
#106
Posted 23 December 2013 - 09:53 AM
GravityScore, on 23 December 2013 - 04:33 AM, said:
Symmetryc, on 15 December 2013 - 02:57 PM, said:
Edit: So like you would have "512 512 512 8 1 " rather than "fffab23"
Raising something to a power is easy for a computer. It's just a simple bit shift, which is probably one of the quickest function a computer could perform. You do need a basic understanding of binary to get this though. Tonnes of stuff on the web for that.
Say you want to raise 2 to the power of 8:
2 in binary is 0010. When you perform a bit shift, all you're doing is moving all the 1s in the binary number to the left a certain number of places. So if we do a bit shift of 1 on the number 2, we get 0100 (see how the 1 moved 1 place to the left?), which in decimal happens to be 4. A bit shift of 2 results in 1000, which happens to be 8. Bit shift of 3 is 0001 0000, which is 16, 0010 0000 is 64, 0100 0000 is 128. See the pattern? So to raise 2 to the power of 8, we just perform a bit shift of 7, giving us 0001 0000 0000, or 256. You can perform a bit shift in lua using the operator << for a left bit shift (moving the 1s to the left), and >> for a right bit shift (moving the 1s to the right). You can use a bit shift in CC Lua using the bit API. Just bit.blshift(2, 7) (which gives 256) or bit.brshift(256, 7) (which gives 2) for left and right shifts respectively.
#107
Posted 23 December 2013 - 12:59 PM
GravityScore, on 23 December 2013 - 04:33 AM, said:
Symmetryc, on 15 December 2013 - 02:57 PM, said:
Edit: So like you would have "512 512 512 8 1 " rather than "fffab23"
Raising something to a power is easy for a computer. It's just a simple bit shift, which is probably one of the quickest function a computer could perform. You do need a basic understanding of binary to get this though. Tonnes of stuff on the web for that.
Say you want to raise 2 to the power of 8:
2 in binary is 0010. When you perform a bit shift, all you're doing is moving all the 1s in the binary number to the left a certain number of places. So if we do a bit shift of 1 on the number 2, we get 0100 (see how the 1 moved 1 place to the left?), which in decimal happens to be 4. A bit shift of 2 results in 1000, which happens to be 8. Bit shift of 3 is 0001 0000, which is 16, 0010 0000 is 64, 0100 0000 is 128. See the pattern? So to raise 2 to the power of 8, we just perform a bit shift of 7, giving us 0001 0000 0000, or 256. You can perform a bit shift in lua using the operator << for a left bit shift (moving the 1s to the left), and >> for a right bit shift (moving the 1s to the right). You can use a bit shift in CC Lua using the bit API. Just bit.blshift(2, 7) (which gives 256) or bit.brshift(256, 7) (which gives 2) for left and right shifts respectively.
Don't you mean Java?
#108
Posted 23 December 2013 - 01:04 PM
MudkipTheEpic, on 23 December 2013 - 12:59 PM, said:
Whoops I wrote that sentence then double checked, and found I had to use the bit API instead of those operators. Forgot to remove the original sentence. Yeah, most languages support the >> and << operator, including Java, C, and C++.
Edited by GravityScore, 23 December 2013 - 01:04 PM.
#109
Posted 28 December 2013 - 11:30 AM
Kinda hard to see how much code it takes to make that runnin while it looks so simple using it ...
I suggest you might add another menu point in the rightclick menu to add sort of start menu
or an icon on the desk like
Quote
| Progname |
-------------
-would be nice if it would safe the open program list like ... hard to explain ... lets say the firefox tabs are saved for next launch maybe ...
Im really noobish with coding, especially lua but as far as i can see, it might be possible to add some lines to procman and adding some sort of .ini file that open processes are saved in
while lws needs to clear the tabs then when closed maybe
I think this would be a step to an actual OS, like you stated its more like a window manager so far
and its pretty much using shell all the time with the chance to switch the window and run more tasks at once ..
ps: sorry for my bad english, i hope you get the meaning
Edited by Conan1981m, 28 December 2013 - 11:39 AM.
#110
Posted 05 April 2014 - 05:06 PM
How about a startup file that starts the programs inside your OS?
PS: I know computercraft 1.6 does that, but versions below don't. And 1.6 is not windowed
#111
Posted 18 April 2014 - 06:53 AM
#112
Posted 18 April 2014 - 11:57 AM
bjornir90, on 18 April 2014 - 06:53 AM, said:
#113
#114
#115
Posted 18 April 2014 - 04:43 PM
bjornir90, on 18 April 2014 - 06:53 AM, said:
So, procman is the process manager. It contains the coroutine manager, which receives events from the system and distributes them among the processes running in LyqydOS. When a program is started, either in the desktop program via the Run Program dialog, or via the start program, a coroutine is created and added to the process list. Some events are hooked by system processes (for instance, lws hooks all three mouse events), so the actual event distribution logic for those events is within those programs. Currently, the three programs with event hooks are lws, desktop, and lrnd.
That should get you started on your explorations.
#116
Posted 02 May 2014 - 02:16 PM
#117
Posted 02 May 2014 - 02:59 PM
#118
Posted 03 May 2014 - 05:50 AM
#119
Posted 03 May 2014 - 06:54 AM
#120
Posted 03 May 2014 - 09:42 AM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users