﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by Craig Outcalt  / Who was that Affinity Masked Man? / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 11:20:28 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Who was that Affinity Masked Man?</title><link>http://www.sqlservercentral.com/Forums/Topic587438-1403-1.aspx</link><description>[quote][b]scott vandenelzen (10/24/2008)[/b][hr]the code posted we incomplete.  can we get the entire thing :)[/quote]IT's all there.  Did you see the scroll bar in the code section?</description><pubDate>Tue, 28 Oct 2008 07:16:48 GMT</pubDate><dc:creator>SQLBOT</dc:creator></item><item><title>RE: Who was that Affinity Masked Man?</title><link>http://www.sqlservercentral.com/Forums/Topic587438-1403-1.aspx</link><description>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.</description><pubDate>Tue, 28 Oct 2008 07:15:12 GMT</pubDate><dc:creator>SQLBOT</dc:creator></item><item><title>RE: Who was that Affinity Masked Man?</title><link>http://www.sqlservercentral.com/Forums/Topic587438-1403-1.aspx</link><description>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:[code]INSERT INTO @PROCMASKSTABLE    SELECT CAST(c.value AS INT) &amp; 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 &amp;lt;= @NUMPROCS and Number &amp;lt;= 31)) AS Bits        WHERE     (c.name = 'affinity mask')[/code]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:[code]select 1073741824 * 2 -- 1073741824 == 2^30[/code]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</description><pubDate>Mon, 27 Oct 2008 23:35:17 GMT</pubDate><dc:creator>Ryan C. Price</dc:creator></item><item><title>RE: Who was that Affinity Masked Man?</title><link>http://www.sqlservercentral.com/Forums/Topic587438-1403-1.aspx</link><description>the code posted we incomplete.  can we get the entire thing :)</description><pubDate>Fri, 24 Oct 2008 07:10:32 GMT</pubDate><dc:creator>scott vandenelzen</dc:creator></item><item><title>RE: Who was that Affinity Masked Man?</title><link>http://www.sqlservercentral.com/Forums/Topic587438-1403-1.aspx</link><description>Nice job</description><pubDate>Sat, 18 Oct 2008 08:25:33 GMT</pubDate><dc:creator>Andrew Peterson-472853</dc:creator></item><item><title>RE: Who was that Affinity Masked Man?</title><link>http://www.sqlservercentral.com/Forums/Topic587438-1403-1.aspx</link><description>Cool Cool article. :)</description><pubDate>Fri, 17 Oct 2008 00:55:01 GMT</pubDate><dc:creator>Anipaul</dc:creator></item><item><title>Who was that Affinity Masked Man?</title><link>http://www.sqlservercentral.com/Forums/Topic587438-1403-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/articles/Bitwise+Operators/64429/"&gt;Who was that Affinity Masked Man?&lt;/A&gt;[/B]</description><pubDate>Fri, 17 Oct 2008 00:30:03 GMT</pubDate><dc:creator>SQLBOT</dc:creator></item></channel></rss>