From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <150737122ff47880b1029e391e01d18e@vitanuova.com> To: 9fans@cse.psu.edu Subject: Re: [9fans] bcopy in APE From: C H Forsyth In-Reply-To: <3F657A14.1090709@ameritech.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="upas-bmwlsnxtcexiaquuasehpmxnwd" Date: Mon, 15 Sep 2003 10:20:29 +0100 Topicbox-Message-UUID: 36d0a8c6-eacc-11e9-9e20-41e7f4b1d025 This is a multi-part message in MIME format. --upas-bmwlsnxtcexiaquuasehpmxnwd Content-Disposition: inline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit memmove(s+1, s, 8); it's usually desirable that after the copy s[2] gets what s[1] had in it, not s[0] (and so on). just checking the initial pointers is fractionally cheaper than the full check for overlap, but is enough to guarantee safety. i did find that on 386 it was better to do the full check because the forward copy was much faster, and the cheap check, though safe, meant that arbitrarily many copies ended up taking the reverse-copy path, just because of malloc outcomes (say). overlapped copy was used on some architectures to set whole buffers to a value having set the first byte, but it's otherwise not usually what's desired. --upas-bmwlsnxtcexiaquuasehpmxnwd Content-Type: message/rfc822 Content-Disposition: inline Return-path: <9fans-admin@cse.psu.edu> Received: from punt-3.mail.demon.net by mailstore for forsyth@vitanuova.com id 19ynvH-0005RI-Ck; Mon, 15 Sep 2003 07:37:24 +0000 Received: from [130.203.4.6] (helo=mail.cse.psu.edu) by punt-3.mail.demon.net with esmtp id 19ynvH-0005RI-Ck; Mon, 15 Sep 2003 07:37:24 +0000 Received: by mail.cse.psu.edu (CSE Mail Server, from userid 60001) id 6919419B4B; Mon, 15 Sep 2003 03:37:15 -0400 (EDT) Received: from psuvax1.cse.psu.edu (psuvax1.cse.psu.edu [130.203.76.6]) by mail.cse.psu.edu (CSE Mail Server) with ESMTP id 51EF719AF6; Mon, 15 Sep 2003 03:37:11 -0400 (EDT) X-Original-To: 9fans@cse.psu.edu Delivered-To: 9fans@cse.psu.edu Received: by mail.cse.psu.edu (CSE Mail Server, from userid 60001) id 0B98419B40; Mon, 15 Sep 2003 03:36:54 -0400 (EDT) Received: from smtp803.mail.sc5.yahoo.com (smtp803.mail.sc5.yahoo.com [66.163.168.182]) by mail.cse.psu.edu (CSE Mail Server) with SMTP id 17C3A19B35 for <9fans@cse.psu.edu>; Mon, 15 Sep 2003 03:36:53 -0400 (EDT) Received: from adsl-68-21-32-231.dsl.sfldmi.ameritech.net (HELO ameritech.net) (dbailey27@ameritech.net@68.21.32.231 with plain) by smtp-sbc-v1.mail.vip.sc5.yahoo.com with SMTP; 15 Sep 2003 07:36:52 -0000 Message-ID: <3F657A14.1090709@ameritech.net> From: northern snowfall User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:0.9.4.1) Gecko/20020518 Netscape6/6.2.3 X-Accept-Language: en-us MIME-Version: 1.0 To: 9fans@cse.psu.edu Subject: Re: [9fans] bcopy in APE References: <3F657661.1090902@ameritech.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: 9fans-admin@cse.psu.edu Errors-To: 9fans-admin@cse.psu.edu X-BeenThere: 9fans@cse.psu.edu X-Mailman-Version: 2.0.11 Precedence: bulk Reply-To: 9fans@cse.psu.edu List-Id: Fans of the OS Plan 9 from Bell Labs <9fans.cse.psu.edu> List-Archive: Date: Mon, 15 Sep 2003 03:36:36 -0500 X-Spam-Status: No, hits=0.1 required=5.0 tests=FROM_ENDS_IN_NUMS,REFERENCES,USER_AGENT_MOZILLA_UA, X_ACCEPT_LANG version=2.55 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) > My question is, why does the function need to increment or > decrement at all? Oh, I get it. Because we're preserving the source vector as best we can. I was just overthinking. Anyone care to confirm or elaborate? > And if there is a specific reason, why does > plan9's implementation do it opposite of the netbsd? Aha! I just realized that the destination argument in the plan9 memmove is the source argument in the BSD bcopy. And, the memmove call in bcopy (/sys/src/ape/lib/bsd/bcopy.c) flips the arguments appropriately. Hah, okay. Duh. Obviously, I need sleep. G'night. Don http://www.7f.no-ip.com/~north_ Yes, soon. Just email me if you need something off the site. --upas-bmwlsnxtcexiaquuasehpmxnwd--