Foro de elhacker.net

Programación => Programación Visual Basic => Mensaje iniciado por: arfgh en 6 Marzo 2012, 03:14 am



Título: Bitshift sar/sal ?
Publicado por: arfgh en 6 Marzo 2012, 03:14 am
alguien sabe como podemos hacer las operaciones de bitshift que equivalen al asm de SAL y SAR ?

gracias


Título: Re: Bitshift sar/sal ?
Publicado por: Karcrack en 6 Marzo 2012, 04:18 am
Esto debería funcionar:
Código
  1. Public Function SAL(ByVal a As Long, ByVal n As Byte) As Long
  2.    SAL = a * (2 ^ (n Mod 32))
  3. End Function
  4.  
  5. Public Function SAR(ByVal a As Long, ByVal n As Byte) As Long
  6.    SAR = a \ (2 ^ (n Mod 32))
  7. End Function


Título: Re: Bitshift sar/sal ?
Publicado por: arfgh en 6 Marzo 2012, 14:23 pm
ok gracias

no tenemos por aquí alguna recopilación de operaciones de este tipo?


Título: Re: Bitshift sar/sal ?
Publicado por: raul338 en 6 Marzo 2012, 16:01 pm
Recopilacion de Funciones con operaciones Binarias. (http://foro.elhacker.net/vb/recopilacion_de_funciones_con_operaciones_binarias-t329680.0.html)