lcong48.c 692 B

12345678910111213141516171819202122232425262728
  1. /* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */
  2. #include <features.h>
  3. #if defined __USE_SVID || defined __USE_XOPEN
  4. #include <stdint.h>
  5. #include <stdlib.h>
  6. #include <string.h>
  7. static int __lcong48_r (unsigned short int param[7], struct drand48_data *buffer)
  8. {
  9. /* Store the given values. */
  10. memcpy (buffer->__x, &param[0], sizeof (buffer->__x));
  11. buffer->__a = ((uint64_t) param[5] << 32 | (uint32_t) param[4] << 16 | param[3]);
  12. buffer->__c = param[6];
  13. buffer->__init = 1;
  14. return 0;
  15. }
  16. # ifdef __USE_MISC
  17. strong_alias(__lcong48_r,lcong48_r)
  18. # endif
  19. void lcong48 (unsigned short int param[7])
  20. {
  21. (void) __lcong48_r (param, &__libc_drand48_data);
  22. }
  23. #endif