I was looking through the source code for Doom, and I found a weird use of bitwise and that I absolutely don't understand.

This page summarizes the projects mentioned and recommended in the original post on /r/C_Programming

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • DOOM

    DOOM Open Source Release

  • tl;dr: Since MAXEVENTS is defined as 64, MAXEVENTS-1 in base 2 is 111111, so when eventtail is 64 it'll wrap back to 0, effectively acting ++eventtail % MAXEVENTS but without the overhead of a full division operation. On any modern PC I'm not sure it matters much, but in the 90's, I bet that was a significant optimization.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts