If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Inconsistent String Behavior
12 posts
• Page 2 of 2 • 1, 2
Re: Inconsistent String Behavior
this is the class I use for Bitmask, it take only 199 byte space to store 1024 bit in the string preset
Edit: some correction
- Code: Select all
class Bitmask
def initialize
@mask = 0
end
def set idx
@mask |= 1 << idx
end
def unset idx
@mask &= ~(1 << idx)
end
def get idx
@mask & (1 << idx) > 0
end
def clear
@mask = 0
end
def save
@mask.to_s(36)
end
def load data
@mask = data.to_i(36)
end
end
Edit: some correction
- Tronic
- Posts: 539
- Joined: Wed Dec 21, 2011 12:59 pm
Re: Inconsistent String Behavior
I don't see where this is any different, apart from my additional safety (I'm avoiding null bytes and don't use bignums, but fixnums, because they are accessed with fewer cycles). Also, I'm already down to 148 bytes (for 1035 states)
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
12 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 105 guests