Changeset c739102 in mainline for uspace/lib/c/include/ieee_double.h


Ignore:
Timestamp:
2012-11-21T23:26:22Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0f2c80a
Parents:
bebf97d (diff), 1f7753a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Mainline changes.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/ieee_double.h

    rbebf97d rc739102  
    11/*
    2  * Copyright (c) 2011 Martin Sucha
     2 * Copyright (c) 2012 Adam Hraska
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libext2
    30  * @{
    31  */
    32 /**
    33  * @file
    34  */
     29#ifndef IEEE_DOUBLE_H_
     30#define IEEE_DOUBLE_H_
    3531
    36 #ifndef LIBEXT2_LIBEXT2_BLOCK_GROUP_H_
    37 #define LIBEXT2_LIBEXT2_BLOCK_GROUP_H_
     32#include <stdint.h>
     33#include <bool.h>
    3834
    39 #include <block.h>
     35/** Represents a non-negative floating point number: significand * 2^exponent */
     36typedef struct fp_num_t_tag {
     37        /** Significand (aka mantissa). */
     38        uint64_t significand;
     39        /** Binary exponent. */
     40        int exponent;
     41} fp_num_t;
    4042
    41 typedef struct ext2_block_group {
    42         uint32_t block_bitmap_block; // Block ID for block bitmap
    43         uint32_t inode_bitmap_block; // Block ID for inode bitmap
    44         uint32_t inode_table_first_block; // Block ID of first block of inode table
    45         uint16_t free_block_count; // Count of free blocks
    46         uint16_t free_inode_count; // Count of free inodes
    47         uint16_t directory_inode_count; // Number of inodes allocated to directories
    48 } ext2_block_group_t;
     43/** Double number description according to IEEE 754. */
     44typedef struct ieee_double_t_tag {
     45        /** The number is a NaN or infinity. */
     46        bool is_special;
     47        /** Not a number. */
     48        bool is_nan;
     49        bool is_negative;
     50        /** The number denoted infinity. */
     51        bool is_infinity;
     52        /** The number could not be represented as a normalized double. */
     53        bool is_denormal;
     54        /**
     55         * The predecessor double is closer than the successor. This happens
     56         * if a normal number is of the form 2^k and it is not the smallest
     57         * normal number.
     58         */
     59        bool is_accuracy_step;
     60        /**
     61         * If !is_special the double's value is:
     62         *   pos_val.significand * 2^pos_val.exponent
     63         */
     64        fp_num_t pos_val;
     65} ieee_double_t;
    4966
    50 typedef struct ext2_block_group_ref {
    51         block_t *block; // Reference to a block containing this block group descr
    52         ext2_block_group_t *block_group;
    53 } ext2_block_group_ref_t;
    54 
    55 #define EXT2_BLOCK_GROUP_DESCRIPTOR_SIZE 32
    56 
    57 extern uint32_t ext2_block_group_get_block_bitmap_block(ext2_block_group_t *);
    58 extern uint32_t ext2_block_group_get_inode_bitmap_block(ext2_block_group_t *);
    59 extern uint32_t ext2_block_group_get_inode_table_first_block(ext2_block_group_t *);
    60 extern uint16_t ext2_block_group_get_free_block_count(ext2_block_group_t *);
    61 extern uint16_t ext2_block_group_get_free_inode_count(ext2_block_group_t *);
    62 extern uint16_t ext2_block_group_get_directory_inode_count(ext2_block_group_t *);
    63 
    64 extern void     ext2_block_group_set_free_block_count(ext2_block_group_t *, uint16_t);
     67extern ieee_double_t extract_ieee_double(double);
    6568
    6669#endif
    67 
    68 /** @}
    69  */
Note: See TracChangeset for help on using the changeset viewer.