add __builtin__popcount() for ImportC (#20790)

This commit is contained in:
Walter Bright 2025-01-27 14:25:04 -08:00 committed by GitHub
parent ea9ead9cae
commit 94714307ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -86,6 +86,12 @@ version (DigitalMars)
return core.bitop.bswap(value); return core.bitop.bswap(value);
} }
uint __builtin__popcount()(ulong value)
{
import core.bitop;
return core.bitop._popcnt(value);
}
// Lazily imported on first use // Lazily imported on first use
private alias c_long = imported!"core.stdc.config".c_long; private alias c_long = imported!"core.stdc.config".c_long;