avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] [bug #44306] Redundancy between rand_r() and do_rand()


From: anonymous
Subject: [avr-libc-dev] [bug #44306] Redundancy between rand_r() and do_rand()
Date: Thu, 19 Feb 2015 09:30:51 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0

URL:
  <http://savannah.nongnu.org/bugs/?44306>

                 Summary: Redundancy between rand_r() and do_rand()
                 Project: AVR C Runtime Library
            Submitted by: None
            Submitted on: jeu. 19 févr. 2015 09:30:50 UTC
                Category: Library
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: libc code
                  Status: None
        Percent Complete: 0%
             Assigned to: None
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: Any
           Fixed Release: None

    _______________________________________________________

Details:

In libc/stdlib/rand.c, the functions rand_r() and do_rand() are
redundant relative to each other. I suggest the following:

  - remove rand_r(),
  - remove the "static" attribute from do_rand(),
  - rename do_rand() -> rand_r(),
  - have rand() call rand_r() instead of do_rand().

This should save 4 bytes of flash on every program using rand() or
rand_r(). It should also save 2 bytes of stack and 7 clock cycles on
calls to rand_r(), more if __AVR_3_BYTE_PC__.

Same thing for random_r() and do_random() in libc/stdlib/random.c.




    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?44306>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]