newRPL - build 1255 released! [updated to 1299]
|
10-31-2019, 04:11 PM
Post: #596
|
|||
|
|||
RE: newRPL - build 1255 released! [updated to 1299]
(10-30-2019 11:29 PM)JoJo1973 Wrote: Claudio, When given a single number, BINTPUTB interprets the integer part as a multi-bit number (little endian!), so you requested 4 bytes to be stored, the first byte to be stored is (N%256), the second byte will be IP(N/256)%256 and so on. This is simply consistent with the little endianness of the platform, which newRPL adopted as well. (10-30-2019 11:29 PM)JoJo1973 Wrote: << 8 MKBINDATA 0 { #1122h #3344h #5566h #7788h } 0 4 BINPUTB >> When given a list, each item is treated as an individual element (byte, word, whatever you selected by using BINPUTB, BINPUTW), so if you use BINPUTB, only the lowest 8 bits will be stored from each number (N%256). In other words, your argument of 4 means "store the first 4 elements of my list of bytes". BINPUTB is consistent with BINGETB, so the string of bytes you get from one bindata object can be stored directly on another one (of course, we have much faster dedicated opcodes for those memory copies). I guess the logic I used is: for BINPUTB you can request any number of bytes to store, therefore you need to provide a string of bytes. That can come either as a list of bytes, or all packed into a single binary number. Same thing for words. (10-30-2019 11:29 PM)JoJo1973 Wrote: 2) UNQUOTEID: while QUOTEID is useful to send unevaluated arguments to functions (but less versatile than userRPL's QUOTE, which accepts symbolic expressions too) I can't see an use for UNQUOTEID: where's its usefulness? There's some dark uses, but the most common case is very simple: to create strings for output, you put the variable name 'X' on the stack, do UNQUOTEID ->STR to get a clean "X" rather than getting the quoted name then trying to remove the quotes from the string. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)