Bug 1467

Summary: FreeBSD log2() issues
Product: ns-3 Reporter: Tom Henderson <tomh>
Component: spectrumAssignee: Nicola Baldo <nicola>
Status: RESOLVED FIXED    
Severity: normal CC: mathieu.lacage, ns-bugs, vedran
Priority: P5    
Version: pre-release   
Hardware: All   
OS: FreeBSD   

Description Tom Henderson 2012-07-06 14:01:17 EDT
Lawrence suggested a patch on the list:
http://mailman.isi.edu/pipermail/ns-developers/2012-July/010493.html

Assigning to src/spectrum; Nicola may suggest a location for a more general header that can be pulled into files using log2().

For reference, this thread talks about how it was solved on another project:
https://github.com/OpenImageIO/oiio/pull/348
Comment 1 Nicola Baldo 2012-07-09 07:38:15 EDT
one first question: shouldn't this patch replace the existing #ifdef added by Tom with changeset 36d9cc69da14? 
http://code.nsnam.org/ns-3-dev/annotate/f43017db07ec/src/lte/model/pf-ff-mac-scheduler.cc
Maybe the patch is against an older version of ns-3?

second question: recently we have been to #include<cmath> following Bug 1276;  on freebsd, is log2 absent from cmath as well?

as for the location of an eventual general header: putting it in spectrum does not make sense, because the lte files being patched do not inherit the use of log2 from spectrum. I'd rather put the general header in core if you want a general ns-3 wide solution. Otherwise, just let the solution be local.
Comment 2 Vedran Miletić 2012-08-28 16:08:11 EDT
I'm with Nicola here, perhaps we should introduce src/core/utils and put this into it. Tom, any thoughts?
Comment 3 Mathieu Lacage 2012-08-29 04:14:29 EDT
I suspect that we could have src/core/utils/math.h or src/core/model/math.h. I do not have any strong opinion other than maybe it is a bit extreme to create utils/ for a single file.
Comment 4 Tom Henderson 2012-10-29 08:50:05 EDT
(In reply to comment #3)
> I suspect that we could have src/core/utils/math.h or src/core/model/math.h. I
> do not have any strong opinion other than maybe it is a bit extreme to create
> utils/ for a single file.

Would be nice to close this out as Dizhi's code depends on it.  I guess I would lean towards src/core/model/math.h, which could be moved to a utils/ if utils/ is added in the future.
Comment 5 Vedran Miletić 2012-10-29 08:57:53 EDT
(In reply to comment #4)
> Would be nice to close this out as Dizhi's code depends on it.  I guess I would
> lean towards src/core/model/math.h, which could be moved to a utils/ if utils/
> is added in the future.

+1

This was fixed in

author	Vedran Miletić <rivanvx@gmail.com>
	Sat, 01 Sep 2012 20:57:21 +0200 (8 weeks ago)
changeset 9063	32755d0516f4
parent 9062 	d14e2430213d
child 9064 	21326214dcd5

by the fix for Bug 1237 - code cleanups related to includes.