- added myself to copyright on files i remember adding large contributions for over...
[openocd.git] / src / helper / binarybuffer.c
index 6aa847aa504367a2f96b54083bed87169e5cd86a..f3ef11ce9f4b9de7bb4b41e6a80dace42eb20fed 100644 (file)
@@ -2,6 +2,9 @@
  *   Copyright (C) 2004, 2005 by Dominic Rath                              *
  *   Dominic.Rath@gmx.de                                                   *
  *                                                                         *
+ *   Copyright (C) 2007,2008 Ã˜yvind Harboe                                 *
+ *   oyvind.harboe@zylin.com                                               *
+ *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
  *   the Free Software Foundation; either version 2 of the License, or     *
@@ -49,43 +52,6 @@ const unsigned char bit_reverse_table256[] =
   0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF
 };
 
-int buf_set_u32(u8* buffer, unsigned int first, unsigned int num, u32 value)
-{
-       unsigned int i;
-       
-       if (!buffer)
-               return ERROR_INVALID_ARGUMENTS;
-
-       for (i=first; i<first+num; i++)
-       {
-               if (((value >> (i-first))&1) == 1)
-                       buffer[i/8] |= 1 << (i%8);
-               else
-                       buffer[i/8] &= ~(1 << (i%8));
-       }
-       
-       return ERROR_OK;
-}
-
-u32 buf_get_u32(u8* buffer, unsigned int first, unsigned int num)
-{
-       u32 result = 0;
-       unsigned int i;
-       
-       if (!buffer)
-       {
-               LOG_ERROR("buffer not initialized");
-               return 0;
-       }
-
-       for (i=first; i<first+num; i++)
-       {
-               if (((buffer[i/8]>>(i%8))&1) == 1)
-                       result |= 1 << (i-first);
-       }
-       
-       return result;
-}
 
 u8* buf_cpy(u8 *from, u8 *to, int size)
 {
@@ -225,7 +191,7 @@ int ceil_f_to_u32(float x)
        return y;
 }
 
-char* buf_to_str(u8 *buf, int buf_len, int radix)
+char* buf_to_str(const u8 *buf, int buf_len, int radix)
 {
        const char *DIGITS = "0123456789abcdef";
        float factor;
@@ -275,7 +241,7 @@ char* buf_to_str(u8 *buf, int buf_len, int radix)
        return str;
 }
 
-int str_to_buf(char* str, int str_len, u8 *buf, int buf_len, int radix)
+int str_to_buf(const char *str, int str_len, u8 *buf, int buf_len, int radix)
 {
        char *charbuf;
        u32 tmp;

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)