[Include] DBits - 16-bit and 8-bit arrays support.
#7

Very nice!

//Edit: To the speed comparator above:
This is no WTF. 8-bit and 32-bit is already built in in PAWN, 16-bit not. So 16-bit needs some calculations and this takes time.

//Edit 2: Why is there a DBIT_VAR?
pawn Код:
#define Bit16_Get(%0,%1)                                                        \
        (((DBITS_VAR=(%1)),DBITS_VAR&1)?(%0[(%1)/2]&0x0000FFFF):((%0[(%1)/2]>>>16)&0x0000FFFF))
You could just do this:
pawn Код:
#define Bit16_Get(%0,%1)                                                        \
        ((((%1)&1)?(%0[(%1)/2]&0x0000FFFF):((%0[(%1)/2]>>>16)&0x0000FFFF))
//Edit 3:
pawn Код:
#define Bit16:%0<%1>                                                            \
        %0[(%1)/2]
I'm not sure, but maybe you should round the real array size up:
pawn Код:
#define Bit16:%0<%1>                                                            \
        %0[((%1)+2)/2] // Round up here
Assume you want 31 16-bit cells, now you divide 31 by 2 and recieve 15. So there would be no 31st cell...
If you round up, there's a 32nd 16-bit cells, which you don't need, but it's still better.
Too much is better than not enough.
Reply


Messages In This Thread
DBits - 16-bit and 8-bit arrays support. - by MrDeath537 - 14.06.2011, 11:26
Re: DBits - 16-bit and 8-bit arrays support. - by SpiderWalk - 14.06.2011, 11:41
Re: DBits - 16-bit and 8-bit arrays support. - by Edvin - 14.06.2011, 11:44
Re: DBits - 16-bit and 8-bit arrays support. - by Mr.GeEk - 14.06.2011, 12:07
Re: DBits - 16-bit and 8-bit arrays support. - by tarmo - 14.06.2011, 12:25
Re: DBits - 16-bit and 8-bit arrays support. - by Anzipane! - 14.06.2011, 13:07
Re: DBits - 16-bit and 8-bit arrays support. - by Double-O-Seven - 14.06.2011, 13:08
Re: DBits - 16-bit and 8-bit arrays support. - by Anzipane! - 14.06.2011, 13:11
Re: DBits - 16-bit and 8-bit arrays support. - by MrDeath537 - 14.06.2011, 13:22
Re: DBits - 16-bit and 8-bit arrays support. - by MrDeath537 - 14.06.2011, 13:46
Re: DBits - 16-bit and 8-bit arrays support. - by Double-O-Seven - 14.06.2011, 13:54
Re: DBits - 16-bit and 8-bit arrays support. - by ylleron - 14.06.2011, 14:20
Re: DBits - 16-bit and 8-bit arrays support. - by MrDeath537 - 14.06.2011, 14:23
Re: DBits - 16-bit and 8-bit arrays support. - by Double-O-Seven - 14.06.2011, 14:29
Re: DBits - 16-bit and 8-bit arrays support. - by GangsTa_ - 14.06.2011, 15:56
Re: DBits - 16-bit and 8-bit arrays support. - by ZeQualX - 14.06.2011, 18:04
Re: DBits - 16-bit and 8-bit arrays support. - by MrDeath537 - 14.06.2011, 21:20
Re: DBits - 16-bit and 8-bit arrays support. - by Lorenc_ - 15.06.2011, 08:59
Re: DBits - 16-bit and 8-bit arrays support. - by leong124 - 15.06.2011, 09:21
Re: DBits - 16-bit and 8-bit arrays support. - by RyDeR` - 15.06.2011, 09:52
Re: DBits - 16-bit and 8-bit arrays support. - by leong124 - 15.06.2011, 11:59
AW: DBits - 16-bit and 8-bit arrays support. - by Forbidden - 15.06.2011, 12:39

Forum Jump:


Users browsing this thread: 4 Guest(s)