<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Cs on Lorbic</title><link>http://localhost:1313/tags/cs/</link><description>Recent content in Cs on Lorbic</description><generator>Hugo</generator><language>en</language><lastBuildDate>Thu, 01 May 2025 20:56:00 +0000</lastBuildDate><atom:link href="http://localhost:1313/tags/cs/index.xml" rel="self" type="application/rss+xml"/><item><title>Bitmasking In Go</title><link>http://localhost:1313/bitmasking/</link><pubDate>Thu, 17 Apr 2025 02:20:00 +0000</pubDate><guid>http://localhost:1313/bitmasking/</guid><description>&lt;h1 id="bitmasking-in-go">Bitmasking in Go&lt;a class="anchorjs-link" href="#bitmasking-in-go" aria-label="Link to section: Bitmasking in Go">&lt;/a>&lt;/h1>&lt;p>Bitmasking is one of those computer science tricks that feels like wizardry, until you realize it&amp;rsquo;s just some clever shifting and binary math. This blog explores the idea, shows how we use it in Go, and why it&amp;rsquo;s surprisingly useful when working with databases like Couchbase.&lt;/p>
&lt;hr>
&lt;h2 id="whats-bitmasking">What&amp;rsquo;s Bitmasking?&lt;a class="anchorjs-link" href="#whats-bitmasking" aria-label="Link to section: What&amp;rsquo;s Bitmasking?">&lt;/a>&lt;/h2>&lt;p>A &lt;strong>bitmask&lt;/strong> is just an integer where each &lt;strong>bit&lt;/strong> (0 or 1) represents a flag or state. Instead of storing multiple booleans in a slice or map, you cram them into a single &lt;code>int&lt;/code>. Fast to compute, fast to store, and great for indexing.&lt;/p></description></item></channel></rss>