October 17, 2008 at 12:30 am
Comments posted to this topic are about the item Who was that Affinity Masked Man?
Craig Outcalt
October 17, 2008 at 12:55 am
Cool Cool article. 🙂
October 18, 2008 at 8:25 am
Nice job
The more you are prepared, the less you need it.
October 24, 2008 at 7:10 am
the code posted we incomplete. can we get the entire thing 🙂
October 27, 2008 at 11:35 pm
Ok, so I'm a (posting) noob on this site, but aren't loops discouraged in these forums?
If you have a zero-based Tally table, you can replace your initializer and loop with something like:
INSERT INTO @PROCMASKSTABLE
SELECT CAST(c.value AS INT) & Bits.BitMask AS Mask
FROM sys.configurations AS c CROSS JOIN
(SELECT Number AS BitNo, CAST(POWER(2.0, Number) AS BIGINT) AS BitMask
FROM Tally WHERE (Number <= @NUMPROCS and Number <= 31)) AS Bits
WHERE (c.name = 'affinity mask')
not saying it's any faster, but the anti-loop people will like it much better 🙂
Also, I think your code will fail on processor 32 (bit 31), because you'll get an integer overflow - try this and see what I mean:
select 1073741824 * 2 -- 1073741824 == 2^30
you need to use a BIGINT.
Also, although I also can't test it, because I don't have more than 32 processors, I think the Affinity64 mask is also a 32-bit number,
for processors 32 through 63, and that you need to use the same logic as for the first 32, and add 32 to resulting numbers...
/Ryan
October 28, 2008 at 7:15 am
That's pretty tight, thanks Ryan.
I don't use tally but I might investigate it. Something about adding a table to avoid loops smells a tad like hackery to this robot 🙂
Great catch on the int overflow. I'll try to update the article.
Craig Outcalt
October 28, 2008 at 7:16 am
scott vandenelzen (10/24/2008)
the code posted we incomplete. can we get the entire thing 🙂
IT's all there. Did you see the scroll bar in the code section?
Craig Outcalt
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply