Module:GetIDEMASectors: Difference between revisions
From Australian Enthusiasts Wiki
Created page with "local p = {} -- Returns the number of IDEMA sectors given a capacity in GB. function p.getIDEMASectors(gbCapacity, sectorSize) -- http://www.idema.org/wp-content/downloads/2..." |
Round |
||
| Line 7: | Line 7: | ||
if (sectorSize == 512) then | if (sectorSize == 512) then | ||
return (97696368 + (1953504 * gb50Less)) | return math.floor(97696368 + (1953504 * gb50Less)) | ||
elseif (sectorSize == 4096) then | elseif (sectorSize == 4096) then | ||
return (12212046 + (244188 * gb50Less)) | return math.floor(12212046 + (244188 * gb50Less)) | ||
else | else | ||
error("getIDEMASectors: Sector size given was not 512 or 4096") | error("getIDEMASectors: Sector size given was not 512 or 4096") | ||
Revision as of 22:30, 11 September 2022
Documentation for this module may be created at Module:GetIDEMASectors/doc
local p = {}
-- Returns the number of IDEMA sectors given a capacity in GB.
function p.getIDEMASectors(gbCapacity, sectorSize)
-- http://www.idema.org/wp-content/downloads/2169.pdf
gb50Less = gbCapacity - 50
if (sectorSize == 512) then
return math.floor(97696368 + (1953504 * gb50Less))
elseif (sectorSize == 4096) then
return math.floor(12212046 + (244188 * gb50Less))
else
error("getIDEMASectors: Sector size given was not 512 or 4096")
end
end
-- Main entry point for this module.
function p.invokeMain(frame)
return p.getIDEMASectors(tonumber(frame.args[1]), tonumber(frame.args[2]))
end
return p