Search:

Type: Posts; User: hamster_nz

Page 1 of 9 1 2 3 4

Search: Search took 0.01 seconds; generated 24 minute(s) ago.

  1. Replies
    1
    Views
    62

    It's pretty inefficient, and I'm not so sure that...

    It's pretty inefficient, and I'm not so sure that "range == 0" is a good idea.

    If doing this, I would generate random bits for the memory holding the double, then explicitly mask and set the sign...
  2. Replies
    4
    Views
    188

    It looks like you are not checking that you are...

    It looks like you are not checking that you are correctly opening the output file



    dst = fopen(obuf, "w+");


    You should check to see if dst is not NULL.
  3. Replies
    4
    Views
    188

    Even just enabling warnings on your compiler will...

    Even just enabling warnings on your compiler will help...



    gcc -o main main.c -Wall -pedantic -O4
    main.c: In function ‘main’:
    main.c:24:18: warning: implicit declaration of function ‘fatal’...
  4. Replies
    8
    Views
    469

    ... just to be sure...

    ... just to be sure...
  5. Can you show where you open the file to read it?

    Can you show where you open the file to read it?
  6. There is one more number between 1.0-DBL_EPSILON...

    There is one more number between 1.0-DBL_EPSILON and 1.0:



    #include <float.h>
    #include <stdio.h>


    void printhex(void *x, size_t s) {
    for(size_t i = 0; i < s; i++)
  7. Me? I would most likely do what I did when I...

    Me? I would most likely do what I did when I needed random numbers that were inside a sphere. Generate random numbers between -1 and 1 (inclusive), and if it s >= 1.0 or <= -1.0 then just loop and...
  8. So I've got this 10GB file of 'baseband' data....

    So I've got this 10GB file of 'baseband' data. It's a 2-channel WAV file, but rather than left and right stereo it's what is called I+Q. It's called baseband because rather than a radio signal at...
  9. If it is an integer -1 < x < 1 then it doesn't...

    If it is an integer -1 < x < 1 then it doesn't leave many options....
  10. Replies
    1
    Views
    325

    The first thing I see is that >= 0should just be...

    The first thing I see is that >= 0should just be > 0.
  11. Currently I am working on decoding the telemetry...

    Currently I am working on decoding the telemetry of the Falcon 9 second stage.

    I've got a raw 10GB data file of the baseband signal, so am building on my DSP skills to convert it into the binary...
  12. Replies
    2
    Views
    419

    One nice project would be a multithreaded prime...

    One nice project would be a multithreaded prime number finder.

    It has quite a few interesting features...
  13. I reformatted your code's intentation void...

    I reformatted your code's intentation


    void main (void)
    {


    //SET UP
    ANSEL = 0; //turn off all analog inputs
    ANSELH = 0;
  14. That code is completely unencumbered, so anybody...

    That code is completely unencumbered, so anybody can use it however you like. Pfease feel free to use it in a MIT Licensed project.

    Oh, I don't know about PNG files, but BMP files are pretty...
  15. With a seed of zero, after a while it gets stuck...

    With a seed of zero, after a while it gets stuck in a loop of repeating 35,246 values.

    If you are feeling idle, try this:



    static uint32_t my_rng(unsigned int x) {
    unsigned int b;
    b...
  16. I hope I haven't coded it wrong.... ...

    I hope I haven't coded it wrong....



    #include <stdio.h>
    #include <limits.h>
    #include <time.h>


    #define bitsof(x) (sizeof(x)*CHAR_BIT)
  17. Replies
    5
    Views
    447

    Here's two writers, one reader. Expand as needed....

    Here's two writers, one reader. Expand as needed.



    #include <stdio.h>
    #include <string.h>
    #include <sys/types.h>
    #include <unistd.h>
    #include <errno.h>
  18. Replies
    5
    Views
    447

    Here's two writers, one reader. You should be...

    Here's two writers, one reader. You should be able to take it from here...



    #include <stdio.h>
    #include <string.h>
    #include <sys/types.h>
    #include <unistd.h>
    #include <errno.h>
  19. Replies
    5
    Views
    447

    Writing is realatively eays - using write() to...

    Writing is realatively eays - using write() to write data to pipes are guaranteed to be atomic only if less that PIPE_BUF bytes are written at a time.

    write

    Reads are a different.

    Because...
  20. Replies
    21
    Views
    846

    I don't think 'errno' works the way this code...

    I don't think 'errno' works the way this code expects...



    ssize_t bytes = write( pipe, data, sizeof(void*) - byte );
    #prama message "Should consider using a mutex here as this...
  21. Replies
    21
    Views
    846

    One day, after many hard nights of debugging...

    One day, after many hard nights of debugging where a few bytes have gone missing in the middle of a stream, or your program has terminated with a write error when you have plenty of disk space left,...
  22. Replies
    21
    Views
    846

    Write does not have to write all the data...

    Write does not have to write all the data requested, it can write just the first byte.



    This is doubly important with pipes, where the pipe can only limited amount of data. It is possible that...
  23. Replies
    21
    Views
    846

    I had a look in the repo, your usage of read()...

    I had a look in the repo, your usage of read() and write() is still broken.



    ssize_t rdpipe( pipe_t pipe, void *data )
    {
    return read( pipe, data, sizeof(void*) );
    }
  24. Thread: Code error

    by hamster_nz
    Replies
    4
    Views
    580

    The same thing we said on discord. "

    The same thing we said on discord. "<=15" should be "< 15"
  25. Replies
    21
    Views
    846

    Your use of the write() and read() system calls...

    Your use of the write() and read() system calls is broken.
Results 1 to 25 of 205
Page 1 of 9 1 2 3 4