Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vm1v6-006RW7-2A for pgsql-hackers@arkaria.postgresql.org; Sat, 31 Jan 2026 03:45:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vm1v4-007ChW-0y for pgsql-hackers@arkaria.postgresql.org; Sat, 31 Jan 2026 03:45:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vm1v3-007ChM-3C for pgsql-hackers@lists.postgresql.org; Sat, 31 Jan 2026 03:45:10 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vm1v2-000GaA-2E for pgsql-hackers@lists.postgresql.org; Sat, 31 Jan 2026 03:45:09 +0000 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-42fbc305882so1764831f8f.0 for ; Fri, 30 Jan 2026 19:45:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1769831106; cv=none; d=google.com; s=arc-20240605; b=jY2ffXGCzuxi+6T1oKbq1++r0VmgSPXjG12pRppitiyHf8d3MLKPP/fd4ZvXtjfKDi SGTkOjBpZF/x2JN5hnICZ3UURfWqganThbO9bOFXSiDMrAVxj/h/Wne1uPao/FlSVqmy SZH8aaiGNEiWjAJVMF84nhpnJOcl3xrpJIi3Y/YfdBSSEHW5nADS0kA2klrret4/z70V XavXNEMn0lYvgNI9gRzEah6C/0is4ZfUJOA2wdB+EkFg9XIkc1PJVHbP+Eu9mCaNSGEG W4cWu8l46Atf3006iSSWSA+mfHuVt0NTL+/UDs91yvOTslMIJp2gLPtnMwsEzayC/atV IuHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=NyMOTACkfw4UZt1FuCHEfuJw+VqEowhrx1zSXPU+h34=; fh=K+sBB4m4jLGkugpkYUBpwigNX0gzsCyxh35fRBZaFp8=; b=btHAqWxFQwaaoQMw1FPadOI8zX8fvopUUP4eTNZ54Rw859OgcVveYBt6PhGzOpPARf VsT0o8VJNe8Lo9jsULKs119ckhTcL9bY1lx+3wBS1BIWPAJTB+15JblnnT1CJRqr3/96 Xo3ecfRfQzv5TBnvWzwYhb0dIF6T81pY2fhtJr0llf+7Lgp3W9FrM/MX8joi9XAhN+9w kE4E43wRJv5QEPQuu3knL0EdkYCWtmmZxs1LkOJR2BKPAuo+2XjhnzOvwDmb5yuWckzo pNReBba89O1N56idVBmiRvuqmXYU4fDZVJxF/AuJQexK7Vh+f6Zl1k4JzV2cwBkvh0l6 WCxA==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769831106; x=1770435906; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=NyMOTACkfw4UZt1FuCHEfuJw+VqEowhrx1zSXPU+h34=; b=Rzbi20HdwWMgeHWaNSaS63sPuRvmF6vfwZEMjEXwHx2UCvWSm4LhUXndz04zdsu/vi XxR8ftsD80rFUvrT0rjDPTn5L1vMi0VRTc9B6q+DE8PUrqM1aMv/8FfWgYpioG/+eypa NjUhSXuQYU1ABwBZQGWWXXcD8Xr+tzA7azx+wQiU2n6TUSqt2g/qAEJAMEK2y1h+pOzF zkSM8lDGEjpw4H00s8Pznct5Jny4odP8YBop3K4h/SpBTnF6yTXx8Q4XCNhxDO9GGRdk tDG6+EUGuQNwQvQa+Yv0VeTa+cp9kbonfqZ5ag8bvEuQxwzjUkMYUfNeJgh0Nr0SSuh9 zSTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769831106; x=1770435906; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=NyMOTACkfw4UZt1FuCHEfuJw+VqEowhrx1zSXPU+h34=; b=nY80GU4AxNju+61W/aalF+etIK83WVepeYaNs7+ALuoeZXMOb/sxahcL5GsDG0Ac7Q HuxAUigaJgSQVSnijfi6WIp0SObQWJlm8IDmipk5qdtHbyv4Qelgh7EpR548Z5E4NCAD Io5oqaC8EZ2UTe5I2PN2qbKi9iZzf8JSgG1reGW2Da3WHPQw0JA6YNlBGP/wTdqfPwZS 6TMY9b++CYvsxodeUEKCgfYCAypp45ZJLb3ADB4vWxSt4REO8Yp/nZvzDeje6kWuUGQv MJDdETNU6tZGjZ6G736SwxvspyEIpDzPjv1H93tkLS+xCQMIk7zXW6NzH/Nhwv9Wbjpo DxDw== X-Forwarded-Encrypted: i=1; AJvYcCXiwsQxk/TCPOltHT/43ZcHWuIPF60204cLJCoWTefySahIDm9VhSYfN7K49E3GWaEPvMY7i4Pg96QKqy3n@lists.postgresql.org X-Gm-Message-State: AOJu0YxFRRhdXT41zZ0yYqssEorQTT1RaJcBRS7loRGWV8Wmw3NIZyDu OoP7Hb5t3//85Mtnj+96qgmIx6yJfO3ikKhtja4pwxlSOaXNw7POCnp+QoKUWyFfHqNkyc/JRGS 0X2W9D32aBLiVtqfqqYAebJwBj7FcIUU= X-Gm-Gg: AZuq6aLe80gkGLQ0axPPS4cP4cs3zr8a9Np33XI38mt9Zzpov3WlaRbbIlTEPngdQTV gYu/h6sCnalW6BZsRAo7tZw+aayEqp8yW9ZnSETYlg3Kx+mvzUTR/cp4Jpf3/Y0umG+OlClPvoU IMv73l+1hERhx11EHynft3EJDW/eXHcst68M0XFba6dAXZUpLAM1hTjMse+XNAXPuRxhu9Q80gk YPa8Y0Op5XJHpPcEXwDRrUXqTlAfcA8DuA1LOhCTYRvyVvk5os+9WYtRZ3kPE4iYdc/tGuBSfHj 0AiAEtvCUhLj3c3FkwhrVEAElmJgoskuiX6yAR4Z68WS+yU2Usp11cgMuYGMlA== X-Received: by 2002:a05:6000:4285:b0:431:b1e:7ff9 with SMTP id ffacd0b85a97d-435f3aba7ddmr5941187f8f.59.1769831106434; Fri, 30 Jan 2026 19:45:06 -0800 (PST) MIME-Version: 1.0 References: <9A17C43D-7A28-4885-8974-555A40C9523E@gmail.com> In-Reply-To: From: David Rowley Date: Sat, 31 Jan 2026 16:44:55 +1300 X-Gm-Features: AZwV_QjuLPJZLjLswiwnOlhXWrBuS64vtTBm6ePVUdTpboMj0ZHt84iyu4i55rg Message-ID: Subject: Re: More speedups for tuple deformation To: John Naylor Cc: Andres Freund , Chao Li , PostgreSQL Developers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, 31 Jan 2026 at 15:48, John Naylor wrote: > + res += __builtin_ctz(~bits[bytenum]); > If bits[bytenum] is 255, then __builtin_ctz(0) is undefined. The top > of the function says Oops, I forgot to cast the byte to uint32 before the bitwise-not. I've fixed locally. Still processing Andres' comments. > + * We expect that 'bits' contains at least one 0 bit somewhere in the mask, > + * not necessarily < natts. > > ...in which case it should be well defined everywhere. Am I missing > something? If we need to handle the 255 case, this should work: > > pg_rightmost_one_pos32(~((uint32) bits[bytenum])) I'd rather handle that in a single byte as the fallback path in that function requires byte-at-a-time processing. David