Ignore:
Timestamp:
Jan 21, 2018, 12:10:09 AM (6 years ago)
Author:
coas-nagasima
Message:

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/asp3_dcre/tinet/net/net_subr.c

    r321 r331  
    22 *  TINET (TCP/IP Protocol Stack)
    33 *
    4  *  Copyright (C) 2001-2009 by Dep. of Computer Science and Engineering
     4 *  Copyright (C) 2001-2017 by Dep. of Computer Science and Engineering
    55 *                   Tomakomai National College of Technology, JAPAN
    66 *
     
    8888#include <tinet_config.h>
    8989
     90#include <net/if.h>
     91#include <net/if_loop.h>
     92#include <net/if_ppp.h>
     93#include <net/ethernet.h>
    9094#include <net/net.h>
     95#include <net/net_endian.h>
    9196
    9297/*
     
    103108net_rand (void)
    104109{
    105         next = (next * 1103515245 + 12345) % (ULONG_C(0x7fffffff) + 1);
     110        next = (next * 99991 + 12345) & ULONG_C(0x7fffffff);
    106111        return next;
    107112        }
     
    114119net_srand (uint32_t seed)
    115120{
    116         next += seed;
     121        SYSTIM now;
     122
     123        syscall(get_tim(&now));
     124        next += now + seed + IF_SRAND();
    117125        }
    118126
     
    186194
    187195/*
    188  *  rev_memcpy_word -- 反転メモリコピー(4 バイト)
     196 *  rev_memcpy_hword -- 反転メモリコピー(2 バイト)
    189197 *
    190198 *    バイト単位にアクセスする事により、
     
    193201
    194202void
    195 rev_memcpy_word (uint8_t *dst, uint8_t *src)
    196 {
    197         *(dst    ) = *(src + 3);
    198         *(dst + 1) = *(src + 2);
    199         *(dst + 2) = *(src + 1);
    200         *(dst + 3) = *(src    );
    201         }
    202 
    203 /*
    204  *  rev_memcmp_word -- 反転メモリ比較(4 バイト)
     203rev_memcpy_hword (void *dst, void *src)
     204{
     205        *((uint8_t*)dst    ) = *((uint8_t*)src + 1);
     206        *((uint8_t*)dst + 1) = *((uint8_t*)src    );
     207        }
     208
     209/*
     210 *  rev_memcpy_word -- 反転メモリコピー(4 バイト)
    205211 *
    206212 *    バイト単位にアクセスする事により、
     
    208214 */
    209215
     216void
     217rev_memcpy_word (void *dst, void *src)
     218{
     219        *((uint8_t*)dst    ) = *((uint8_t*)src + 3);
     220        *((uint8_t*)dst + 1) = *((uint8_t*)src + 2);
     221        *((uint8_t*)dst + 2) = *((uint8_t*)src + 1);
     222        *((uint8_t*)dst + 3) = *((uint8_t*)src    );
     223        }
     224
     225/*
     226 *  rev_memcmp_word -- 反転メモリ比較(4 バイト)
     227 *
     228 *    バイト単位にアクセスする事により、
     229 *    境界へのアラインの問題を解決する。
     230 */
     231
    210232int_t
    211 rev_memcmp_word (uint8_t *data1, uint8_t *data2)
     233rev_memcmp_word (void *data1, void *data2)
    212234{
    213235        int_t   ix, diff;
    214236
    215         for (ix = 4; ix -- > 0; ) {
    216                 diff = *(data1 + ix) -  *(data2 + (3 - ix));
     237        for (ix = sizeof(uint32_t); ix -- > 0; ) {
     238                diff = *((uint8_t*)data1 + ix) -  *((uint8_t*)data2 + (3 - ix));
    217239                if (diff != 0)
    218240                        return diff;
Note: See TracChangeset for help on using the changeset viewer.