i couldn't find a way to increment those like an integer (which makes it difficult to generate all possible permutations). andrew
On Monday, 30 December 2013 14:27:04 UTC-3, Kevin Squire wrote: > > There are BitArrays (and BitVectors). > > Kevin > > On Monday, December 30, 2013, andrew cooke wrote: > >> right, or just loop through the existing types and check whether >> 8*sizeof() is large enough. >> >> i didn't find anything in base either. the reason why o thought it >> should perhaps be added is because it requires knowledge of hat sizes are >> supported. >> >> andrew >> >> On Monday, 30 December 2013 12:24:20 UTC-3, John Myles White wrote: >>> >>> I’m still a little confused, but it sounds like Elliot’s suggestion was >>> right: iceil(log2(x)) will tell you how much bits are needed to represent >>> the value, so you’d need some function that wraps that calculation and then >>> finds the closest power of 2 to the output to determine the right storage >>> type. >>> >>> I’m pretty sure that function doesn’t exist in Base. >>> >>> — John >>> >>> On Dec 30, 2013, at 6:35 AM, andrew cooke <[email protected]> wrote: >>> >>> > >>> > julia> smallest_uint(5) >>> > Uint8 >>> > >>> > so this isn't typeof() (which you might have been describing). >>> > >>> > i have code that needs to generate a table of values (bit fields, but >>> Vector{Bit} isn't so useful), but the number of the bits can vary. >>> > >>> > andrew >>> > >>> > On Monday, 30 December 2013 00:00:11 UTC-3, John Myles White wrote: >>> > I’m a little unsure what you mean. Are you asking for a function that >>> given a 32bit value returns that it’s of type Uint32? I would guess (but >>> maybe am way offbase) that you’ll be storing 30bit unsigned integers inside >>> of Uint32’s, right? >>> > >>> > — John >>> > >>> > On Dec 29, 2013, at 7:45 PM, andrew cooke <[email protected]> wrote: >>> > >>> > > question says it all really. if i need to deal with 30bit unsigned >>> integers, is there anything that returns Uint32? >>> > > >>> > > [obviously i can just tabulate what there is if missing, but i >>> wondered if it would also be good for the std lib.] >>> > > >>> > > thanks, andrew >>> > >>> >>>
