From d253640ea28b73050f5fbfce6f39a4d0131486b0 Mon Sep 17 00:00:00 2001 From: vgorin Date: Sun, 5 May 2019 16:22:56 +0300 Subject: [PATCH] update documentation in "Fractions" library --- contracts/Fractions.sol | 3 +++ contracts/Fractions16.sol | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/contracts/Fractions.sol b/contracts/Fractions.sol index 3521268..c2bc960 100644 --- a/contracts/Fractions.sol +++ b/contracts/Fractions.sol @@ -1,5 +1,8 @@ pragma solidity 0.4.23; +/** + * @dev Deprecated. Use Fractions16/Fractions32 instead + */ library Fractions { /// @dev 32-bit structure representing proper fraction struct Fraction { diff --git a/contracts/Fractions16.sol b/contracts/Fractions16.sol index 68b83a9..d8b12ab 100644 --- a/contracts/Fractions16.sol +++ b/contracts/Fractions16.sol @@ -1,11 +1,15 @@ pragma solidity 0.4.23; /** + * @title Fractions 16-bit Library + * * @notice Library for working with fractions. * @notice A fraction is represented by two numbers - nominator and denominator. * @dev A fraction is represented as uint16, * higher 8 bits representing nominator * and lower 8 bits representing denominator + * + * @author Basil Gorin */ library Fractions16 { /** @@ -96,6 +100,7 @@ library Fractions16 { * @return nominator */ function getNominator(uint16 f) internal pure returns(uint8) { + // return high 8 bits return uint8(f >> 8); } @@ -105,6 +110,7 @@ library Fractions16 { * @return denominator */ function getDenominator(uint16 f) internal pure returns(uint8) { + // return low 8 bits return uint8(f); }