broadcast address and erlang:'bnot'/1

Claes Wikstrom klacke@REDACTED
Tue Nov 22 12:10:45 CET 2005


Bengt Kleberg wrote:
> greetings,
> 
> i am creating broadcast addresses. is there such a function in an erlang 
> module? my current solution is:
> 
> broadcast_address( Address, Mask ) ->
>     Fun = fun ( Int ) -> 255 bxor Int end,
>     Inverted = lists:map( Fun, Mask ),
>     lists:zipwith( fun erlang:'bor'/2, Address, Inverted ).
> 
> is there a better way?
> 

Take a look at my ipcalc.erl in lib/msc/src/ipcalc.erl in Jungerl
it does all sort of IP address manipulations in a .. well better way.
Only ipv4 though.

/klacke



More information about the erlang-questions mailing list