addon functions...

H

Hul Tytus

Guest
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
 
tirsdag den 1. august 2023 kl. 23.23.37 UTC+2 skrev Hul Tytus:
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

https://man7.org/linux/man-pages/man3/ldiv.3p.html ?
 
On 8/1/2023 2:23 PM, 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?

For positive offset and positive, non-zero SECTOR_SIZE:

sector = int(offset/SECTOR_SIZE)
offset_in_sector = offset - sector * SECTOR_SIZE

(poor choice of original variable names reliant on scope)
 

Welcome to EDABoard.com

Sponsor

Back
Top