Old 06-19-2018, 12:10 PM   #1
James Slanger
Human being with feelings
 
Join Date: Feb 2018
Posts: 24
Default Recommended MEMSET primer?

Does anyone have a recommended educational source on using memsets as multi-dimensional arrays? Trying to wrap my head around EEL and the best way to implement arrays.
James Slanger is offline   Reply With Quote
Old 06-19-2018, 12:33 PM   #2
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Germany
Posts: 6,779
Default

Two dimensional array:

a = 12345; // some number denoting the start of the array in memory. Can be 0 if you only need a single array
n = 100; // the first index ruins 0.. 99
a[i+j*n] = value;

-Michael
__________________
www.boa-sorte.de
mschnell is offline   Reply With Quote
Old 06-19-2018, 02:02 PM   #3
James Slanger
Human being with feelings
 
Join Date: Feb 2018
Posts: 24
Default

Thanks Michael! I should have paid more attention in my CS for Musicians course...
One more basic question, how big is each memory slot? Sizeof(double)? Specifically how many bit flags can I store in each slot?
James Slanger is offline   Reply With Quote
Old 06-19-2018, 03:10 PM   #4
James Slanger
Human being with feelings
 
Join Date: Feb 2018
Posts: 24
Default

For anyone else looking for similar fundamentals, it just occured to me to use search terms with “JSFX EEL” instead of “OSCii bot.” Most of my questions have been asked and answered on the JSFX forum.

Last edited by James Slanger; 06-19-2018 at 03:24 PM.
James Slanger is offline   Reply With Quote
Old 06-19-2018, 09:23 PM   #5
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Germany
Posts: 6,779
Default

Each slot is a floating point number. I once used such EEL floating point number to store Bytes (in fact JSFX sliders for characters of text), and found that I could store five bytes in each. So I suppose it's safe that here are least 40 bits in the mantissa. I guess in fact it should be 47 before it gets unnormalized, plus the sign and the exponent and the exponent's sign, which would be tricky to access.

For such numbers beware of the fact that EEL uses a "soft" compare with any "==" or equivalent compares. Here the symbol "===" is provided for binary compare.

-Michael
__________________
www.boa-sorte.de

Last edited by mschnell; 06-19-2018 at 09:28 PM.
mschnell is offline   Reply With Quote
Old 06-20-2018, 07:23 AM   #6
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Germany
Posts: 6,779
Default

I just did a test and what I said seems not to be correct.

I found that 1<<31 is negative and 1<< 32 is zero.

So eel seems to do logical operations with 32 bit even on reaper 64 bit

But using multiplications, you seem to be able to store 52 bits in a slot:

Code:
descr: test1
@init
x = 0;
xf1 = 0;
xf2 = 0;
y = 0;
z = 0;
yf = 1;
yfa = 1;
loop(52,
  y = 1 << z;
  y != 0 ? (
    x += 1;
  );
  yf = yf * 2;
  yfa = yf + 1;
  yfb = yfa - 1;
  yf == yfb  ? (
    xf1 += 1;
  );
  yf === yfb ? (
    xf2 += 1;
  );
  z += 1;
);
Try changing the 52 to e.g. 53

-Michael
__________________
www.boa-sorte.de
mschnell is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:13 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.