Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #31977

Re: addon functions

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.arch.embedded
Subject Re: addon functions
Date 2023-08-02 18:38 +0200
Organization A noiseless patient Spider
Message-ID <uae0ph$5oj9$1@dont-email.me> (permalink)
References <uabt18$qtu$1@reader2.panix.com>

Show all headers | View raw


On 01/08/2023 23:21, Hul Tytus wrote:
> Lewin Edwards in his dosfs file system uses the ldiv() functions shown below:
> 	sector = ldiv(offset, SECTOR_SIZE).quot  and
> 	offset = ldiv(offset, SECTOR_SIZE).rem
> Anybody know how this is declared or, maybe, defined?
> 
> Hul
> 

It's a standard C library function.  You can see its definition in the C 
standards (draft versions of all modern C standards are freely available 
online).  A good reference for C is the "cppreference" site, with the 
exact page here being:

<https://en.cppreference.com/w/c/numeric/math/div>

The "div" functions are almost never used these days - any decent 
compiler will do as good or better when the code is expressed simply as:

	sector = offset / SECTOR_SIZE;
	offset = offset % SECTOR_SIZE;

But the "div" functions made sense with older and poorer compilers.

Back to comp.arch.embedded | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

addon functions Hul Tytus <ht@panix.com> - 2023-08-01 21:21 +0000
  Re: addon functions Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2023-08-01 23:44 +0200
  Re: addon functions Grant Edwards <invalid@invalid.invalid> - 2023-08-01 22:26 +0000
    Re: addon functions Hul Tytus <ht@panix.com> - 2023-08-03 16:52 +0000
  Re: addon functions David Brown <david.brown@hesbynett.no> - 2023-08-02 18:38 +0200

csiph-web