Skip to content

if TF_CKSUM_NONE is used, we can use memcpy instead of single byte copy loop #28

Open
@asmwarrior

Description

@asmwarrior

The patch something like this:

#if TF_CKSUM_TYPE == TF_CKSUM_NONE
    memcpy(outbuff, data, data_len);
#else
    for (i = 0; i < data_len; i++) {
        b = data[i];
        outbuff[pos++] = b;
        CKSUM_ADD(*cksum, b);
    }
#endif // TF_CKSUM_TYPE

In our test, it looks like using memcpy is much faster, and in one test, it reduced to 1/40 of the manually loop byte copy time.

I have use this library in several projects.

For example, I use it in UDP data sending, I think we don't need CRC check here, because the UDP protocol already does some data check.
While the UDP package is not sending in a synchronized way, so I use the ID filed of the TinyFrame to resort the messages. It works really nice! Thanks for this great project!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions