aboutsummaryrefslogtreecommitdiffstats
path: root/lib/utils.c
diff options
context:
space:
mode:
authorConstanza Heath <[email protected]>2015-10-06 16:40:32 -0700
committerConstanza Heath <[email protected]>2015-10-06 16:40:32 -0700
commit8e89499de09686c63dd98fae72e08d27b88f0fa6 (patch)
tree6ffa61e3b63eedeb0aa5e50a918e0115c376d334 /lib/utils.c
parent5c4da9469e051980a4e042a23961dbedd03e2264 (diff)
Fix whitespace, update comments, remove unused headers and variables
Signed-off-by: Constanza Heath <[email protected]>
Diffstat (limited to 'lib/utils.c')
-rw-r--r--lib/utils.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/lib/utils.c b/lib/utils.c
index f68002c..3883d5f 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -27,9 +27,6 @@
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * utils.c -- Platform-dependent run-time operations.
- *
*/
#include <utils.h>
@@ -39,24 +36,25 @@
#define MASK_MOST_SIG_BIT 0x80
#define MASK_TWENTY_SEVEN 0x1b
-uint32_t copy (uint8_t *to,
- uint32_t to_len,
- const uint8_t *from,
- uint32_t from_len) {
-
- if (from_len <= to_len) {
- (void) memcpy (to, from, from_len);
- return from_len;
- } else {
- return TC_FAIL;
- }
+uint32_t _copy(uint8_t *to, uint32_t to_len, const uint8_t *from, uint32_t from_len)
+{
+ if (from_len <= to_len) {
+ (void)memcpy(to, from, from_len);
+ return from_len;
+ } else {
+ return TC_FAIL;
+ }
}
-void set (uint8_t *to, uint8_t val, uint32_t len) {
- (void) memset (to, val, len);
+void _set(uint8_t *to, uint8_t val, uint32_t len)
+{
+ (void)memset(to, val, len);
}
-/*Doubles the value of a byte for values up to 127. Original 'return ((a<<1) ^ ((a>>7) * 0x1b))' re-written to avoid extra multiplicaiton which the compiler won't be able to optimize */
-uint8_t double_byte (uint8_t a) {
- return (a & MASK_MOST_SIG_BIT) ? ((a << 1) ^ MASK_TWENTY_SEVEN) : (a << 1);
+/* Doubles the value of a byte for values up to 127. Original 'return
+ * ((a<<1) ^ ((a>>7) * 0x1b))' re-written to avoid extra multiplicaiton which
+ * the compiler won't be able to optimize */
+uint8_t _double_byte(uint8_t a)
+{
+ return (a & MASK_MOST_SIG_BIT) ? ((a << 1) ^ MASK_TWENTY_SEVEN) : (a << 1);
}