Download Pelles C here: http://www.pellesc.se
Quote from: Pelle on March 15, 2026, 11:32:37 AMI think ckd_<op>() came more or less straight from GCC to the C23 standard, and like some other GCC "innovations" it's a bit over-worked / under-thinked.Thank you, Pelle!
I will revise my initial implementation slightly, mostly just to reject more bogus cases -- like the original bug report.
Quote from: Pelle on March 15, 2026, 11:45:36 AMIn the low-I/O C runtime function _write(), when operating in text mode (ANSI/UTF-16LE/UTF-8/...), there is a ~2kB buffer for LF to CRLF translation. When this buffer is full, the content is sent to the destination (console/file/...), the buffer cleared, and the translation resumed. When resuming the translation the first character was lost (in translation).Thank you, Pelle!
( The printf family is one path to the _write() function )
Quote from: TimoVJL on March 16, 2026, 08:09:44 PMHow project works with version 14 rc1 ?
It is possible to have many Pelles C versions in test PC
call "%PROJECT_DIR%\env_pelles32.bat"@echo off
REM Sets PellesC environment for x86 builds.
call "C:\Program Files\PellesC\Bin\povars32.bat"
@echo off
set PellesCDir=C:\Program Files\PellesC
rem
echo Setting 32-bit environment for Pelles C...
rem
set PATH=%PellesCDir%\Bin;%PATH%
set INCLUDE=%PellesCDir%\Include;%PellesCDir%\Include\Win;%INCLUDE%
set LIB=%PellesCDir%\Lib;%PellesCDir%\Lib\Win;%LIB%
QuoteChatGPT:
Assuming the usual widths on a typical modern desktop/compiler:
unsigned short = 16 bits
unsigned int = 32 bits
stdc_first_leading_one(x) returns the 1-based position of the first 1 when scanning from the most-significant bit (MSB).
stdc_first_leading_zero(x) returns the 1-based position of the first 0 when scanning from the MSB.
For 4, the bit pattern is ...00000100 (only bit 2 set, counting from LSB starting at 0):
First leading one is at position width - 2
First leading zero is at position 1 (because the MSB is 0 for the value 4)
So the output will be:
a1 one:14 a1 zero:1
a2 one:30 a2 zero:1
Explanation:
a1 (16-bit): 16 - 2 = 14
a2 (32-bit): 32 - 2 = 30
If you run this on a platform where unsigned int is not 32-bit (or unsigned short not 16-bit), the one: numbers will change accordingly, but the zero: values will still be 1 for 4 (since the MSB is still 0).
Page created in 0.044 seconds with 17 queries.