World: r3wp
[!REBOL3]
older newer | first last |
Pekr 21-Apr-2010 [2270] | This is why I originally objected, and started all this discussion ... conversion is left padded (your binary value to the right), whereas OR/AND are right padded (value applied from the left) |
Ladislav 21-Apr-2010 [2271] | but, if the TO-INTEGER function obtains a 32-bit binary, it is not reasonable to expect it is not 32-bit |
Pekr 21-Apr-2010 [2272] | This is what guys tried to tell me - it is not probably being a 32 bit binary ... it is just 32 bits, placed somewhere along the way in 64 bit slot, or in the binary stream :-) |
Cyphre 21-Apr-2010 [2273] | Ladislav, ah, yes, you are right..then I think that your propsal is reasonable. |
Pekr 21-Apr-2010 [2274x3] | with such explanation, your 32 bit binary is just first 32 bits of 64 binary, and then the result might be regarded being OK,no? :-) |
but - the way Cyphre wrote his example above, it might be understandable ... simply put, if you want full slot, you have to padd it from the left ... or it is just 32 bit value, and hence should yield -1 | |
I think now I finally understand, what you mean :-) | |
Ladislav 21-Apr-2010 [2277] | first 32 bits of 64-bit binary is nonsense (you cannot convert "first 32 bits of 64-bit binary" to integer in any reasonable way) |
Pekr 21-Apr-2010 [2278] | you can - you just take first 32 bits, regard it being a 32bit binary, but you still pretend it comes from 64 bit slot ... and convert it :-) (just a joke :-) |
Ladislav 21-Apr-2010 [2279x2] | the only thing you can do is to convert "last 32 bits of 64-bit binary" |
(that is actually the description of what is going on currently in the TO-INTEGER function) | |
Pekr 21-Apr-2010 [2281] | ... and according to that description, current result is OK ... no? |
Ladislav 21-Apr-2010 [2282] | Yes, the current result is OK, if you pretend, that you did not obtain a 32-bit binary. But, I am not schizophrenic enough to be able to pretend I did not obtain 32-bit binary, when I did. |
Pekr 21-Apr-2010 [2283x3] | I think I will be OK with either solution .... (as I can fully see the consequences), I just need it being documented on some examples ..... |
I can = I can't | |
if OR and AND work "from left" ... then your proposal of #{FFFFFFFF} being -1 is logical too .... but guys might not like it, because in such a case, you can't easily convert to integer, unless you pad ... and we have no fast way to pad binaries currently ... | |
Steeve 21-Apr-2010 [2286] | what do you mean by no fast way to pad binaries ? |
Pekr 21-Apr-2010 [2287] | I mean - #{FFFFFFFF} being treated as #{00000000FFFFFFFF} for OR and AND operations .... |
Steeve 21-Apr-2010 [2288] | i don't understand why you don't chose the opposite way (dealing with integers) it's simpler and faster |
Pekr 21-Apr-2010 [2289x2] | well, why not scrap binary altogether, no? What is binary for, if I should use integers? All docs describing some interface, mostly talk hexa. I know that hexa is not binary, but I want to see, what is happening with my bytes. Something like 4294967295 is telling me nothing. And putting binary/hexa helpers in comments is strange way of doing things. I want to see bytes, and bits .... |
I can understand, that if you are really experienced, you might prefer integers, and shifting, etc. | |
Steeve 21-Apr-2010 [2291x2] | hum ok, you want pad-bin as fast as possible... |
R3 ? | |
Pekr 21-Apr-2010 [2293] | yes, R3 .... I posted one func, did you see it? |
Steeve 21-Apr-2010 [2294] | yup |
Pekr 21-Apr-2010 [2295] | well, it's crap :-) The computation of existing int-size each time is not probably necessary. Maybe if we have it as a constant somewhere in system structure, it might be faster ... it is just for my testing purposes, not really a show stopper. I might in the end use integers as well, it is just that I was never good in binary handling, and it helps me to see, what is happening with bytes and bits ... |
Maxim 21-Apr-2010 [2296] | pekr, you can easily build an extension which handles your specific binarie wishes and it will be VERY fast. |
Pekr 21-Apr-2010 [2297] | I am not saying I can't .... I can as well start with mezzanines ... good enough for my testing purposes, or even for target purpose = send few bytes of control commands to router :-) |
Steeve 21-Apr-2010 [2298] | >> pad-bin: func [bin][to-binary to-integer bin] >> pad-bin #{8000} == #{0000000000008000} That's all ? |
Pekr 21-Apr-2010 [2299x2] | haha, clever :-) today I just tried with to-binary bin, I thought it will re-convert it :-) But this to-integer trick did it :-) |
maybe no reason create a function for it, just state it in comments: to-binary to-integer #{8000} ;--- make it 64 bit | |
Steeve 21-Apr-2010 [2301x2] | Usually I make shortcuts for to-binary and to-integer in my scripts (which have insanly long names in the rebol world) I used to use: toi, tob, or int and bin |
bin int #{8000} | |
BrianH 21-Apr-2010 [2303] | Sounds good. But it is still better to do the conversions to the most efficient method ahead of time if you can. REBOL is hand-optimized. |
Steeve 21-Apr-2010 [2304x2] | As far I can remember our community is not very good with graphic designs, but hey we are coder ! |
wrong thread... | |
AdrianS 21-Apr-2010 [2306] | Brian - I seem to recall that the JVM as a target paltform for REBOL was discounted (because of performance and not having tail-call optimization, I think) - have you any opinion on targetting the Microsoft DLR? This would be a good way to get traction by being able to run in browsers (not just IE) without a REBOL plugin (well, assuming that Silverlight was already installed). Some browser samples in Ruby and Python: http://www.visitmix.com/labs/gestalt/samples/ This page walks thrugh running Ruby in the browser: http://www.rubyinside.com/ironruby-silverlight-ruby-in-browser-3192.html |
BrianH 21-Apr-2010 [2307] | I have been giving the subject some thought, and even more so since Silverlight came out. It would be the best way to get REBOL into Windows Phone 7, for instance. I don't see how the tail-call thing would affect REBOL on Java though: REBOL doesn't do tail-call optimization anyways. But we might want to wait for Java 7 and its dynamic types (Java's cheap knock-off of the DLR). |
Graham 21-Apr-2010 [2308] | R3 question? http://synapse-ehr.com/forums/showthread.php?53-Error-Illegal-entry-in-bfchar-block-in-ToUnicode-CMap |
BrianH 21-Apr-2010 [2309] | No, it's not an R3 question, those functions don't exist in R3. |
Graham 21-Apr-2010 [2310] | Must be some library he is using |
Steeve 21-Apr-2010 [2311x2] | trying to do scheme above tcp to aid with async protos |
but each time i stick my nose in R3's network stuffs, I encounter limits which annoys me | |
Pekr 21-Apr-2010 [2313] | what limits, for e.g.? |
Steeve 21-Apr-2010 [2314x6] | First, we can't add our own parameters to actors or change their type |
e.g I wanted to user the refinement read/part to allow custom breaking rules | |
>> read/part port 100 ; to read only 100 bytes Fine it wors | |
*works | |
but then i wanted to allow any type of breaking rule, like >> read/part port crlf ; to break into lines And event more powerfull: >> read/part port [thru #"^@] To allow any parsing rule as breaking point | |
but then i wanted to allow any type of breaking rule, like >> read/part port crlf ; to break into lines And event more powerfull: >> read/part port [thru #"^@] To allow any parsing rule as breaking point | |
older newer | first last |