octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pkg netlist


From: David Bateman
Subject: Re: pkg netlist
Date: Mon, 05 Mar 2007 23:40:29 +0100
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

John W. Eaton wrote:
> On  5-Mar-2007, David Bateman wrote:
> 
> | Well MD5 only needs as little as 64bytes of a file in memory at any
> | time, so yes for very large files the above might swap whereas md5sum
> | system function won't. It's fairly easy to process a file rather than a
> | string, but as you say I'd not like md5sum choosing between a file or a
> | string based on context. I don't really like an option either, but
> | prefer it to two different function names. I'd therefore propose, a
> | trailing option like in the attached patch, where the default is to
> | treat the first argument as a filename (since thats what Bob prefers),
> | and as a string if the second argument evaluates to true. Consider the
> | attached patch. Given what you said above I applied it..
> 
> OK, thanks.
> 
> BTW, your example
> 
>   fid = fopen (file, "rb")
>   buf = fread(fid)
>   fclose(fid)
>   md5 = md5sum(char(buf)')
> 
> would be more efficient if written this way:
> 
>   fid = fopen (file, "rb")
>   buf = fread (fid, Inf, "char")
>   fclose(fid)
>   md5 = md5sum (buf)
> 
> as it avoids storing the data in a double precision array and then
> converting to char.  Also, I don't see the need for the transpose on
> buf.
> 
> jwe
> 


Ok, I don't often use fread and missed the syntax to read directly into
a char array. In any case I added the code to read directly from a file
and so the above example is now moot..

Cheers
David


reply via email to

[Prev in Thread] Current Thread [Next in Thread]